Workflow API reference¶
The workflow package contains persistent graph compositions and deprecated
compatibility workflows. New code should prefer PlanningExecutionAgent and
ThinkPlanningExecutionAgent.
BaseWorkflow
¶
Bases: ABC
Abstract base class for all workflow implementations in the URSA framework.
BaseWorkflow provides a standardized foundation for building workflows consisting of LLM-powered agents with built-in telemetry, configuration management, and execution flow control. It handles common tasks like input normalization, thread management, metrics collection, and LangGraph integration.
Subclasses only need to implement the _invoke method to define their core functionality, while inheriting standardized invocation patterns, telemetry, and graph integration capabilities. The class enforces a consistent interface through runtime checks that prevent subclasses from overriding critical methods like invoke().
The agent supports direct invocation with inputs, with automatic tracking of token usage, execution time, and other metrics. It also provides utilities for integrating with LangGraph through node wrapping and configuration.
Subclass Inheritance Guidelines
- Must Override: _invoke() - Define your agent's core functionality
- Can Override: _normalize_inputs() - Customize input handling Various helper methods
- Never Override: invoke() - Final method with runtime enforcement call() - Delegates to invoke Other public methods (build_config, write_state, add_node)
To create a custom agent, inherit from this class and implement the _invoke method:
class MyWorkflow(BaseWorkflow):
def _invoke(self, inputs: Mapping[str, Any], **config: Any) -> Any:
# Process inputs and return results
...
Source code in src/ursa/workflows/base_workflow.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
__call__(inputs, /, **kwargs)
¶
__init_subclass__(**kwargs)
¶
Ensure subclass does not override key method.
Source code in src/ursa/workflows/base_workflow.py
ainvoke(inputs=None, /, *, config=None, **kwargs)
async
¶
Asynchronously execute the workflow with normalized inputs.
Subclasses can provide a native async implementation by overriding
_ainvoke. The default _ainvoke implementation runs the sync
_invoke implementation in a worker thread.
Source code in src/ursa/workflows/base_workflow.py
invoke(inputs=None, /, *, config=None, **kwargs)
¶
Executes the agent with the provided inputs and configuration.
This is the main entry point for agent execution. It handles input normalization, telemetry tracking, and proper execution context management. The method supports flexible input formats - either as a positional argument or as keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Optional[InputLike]
|
Optional positional input to the agent. If provided, all non-control keyword arguments will be rejected to avoid ambiguity. |
None
|
config
|
Optional[dict]
|
Optional configuration dictionary to override default settings. |
None
|
**kwargs
|
Any
|
Additional keyword arguments that can be either: - Input parameters (when no positional input is provided) - Control parameters recognized by the agent |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The result of the agent's execution. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If both positional inputs and non-control keyword arguments are provided simultaneously. |
Source code in src/ursa/workflows/base_workflow.py
Hypothesis
dataclass
¶
One competing hypothesis to investigate.
Source code in src/ursa/workflows/_hypotheses.py
HypothesisInvestigation
dataclass
¶
Recorded outcome of a single (quarantined) investigation branch.
Source code in src/ursa/workflows/hypothesis_symposium.py
HypothesisOrchestratorWorkflow
¶
Bases: WorkflowToolsMixin, BaseWorkflow
Hypothesize, then let an orchestrator spawn/review per-hypothesis agents.
A dynamic-topology alternative to
:class:~ursa.workflows.hypothesis_symposium.HypothesisSymposiumWorkflow,
intended for empirical comparison. Every scientific phase is exposed as an
overridable hook.
Because the topology is dynamic there is no environment object to hand to
run_with_visualization, so this workflow records its own environment run:
it opens an :func:environment_run_recorder for the whole orchestration and
threads the resulting run config into both the orchestrator agent and every
spawned investigator. That captures (a) explicit orchestrator->investigator
delegation events emitted here and (b) all structured events emitted by the
sub-agents themselves, streamed live to events.jsonl. Delegation traffic
is additionally rendered to the stdout logs so progress is visible without a
dashboard.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | |
build_hypotheses(query, context, config)
¶
Produce competing hypotheses via the HypothesizerAgent.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
format_result(result)
¶
Return only the final write-up, not the whole state.
The full state carries bulky intermediate data (raw orchestrator result,
parsed hypotheses, the hypothesis-space markdown, investigator
identities). Returning all of it makes the dashboard output unreadable,
so surface just the detailed final answer, falling back to summary
if a subclass produced one instead.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
HypothesisSymposiumState
¶
Bases: TypedDict
Parent graph state.
Fan-in requires reducer channels, so investigation results and failures use
operator.add accumulators. Overwrite([]) resets them between phases.
Source code in src/ursa/workflows/hypothesis_symposium.py
HypothesisSymposiumWorkflow
¶
Bases: WorkflowToolsMixin, BaseWorkflow
Hypothesize -> fan out -> investigate -> converge -> review -> update.
Every scientific phase is exposed as an overridable hook so a later Plan D
layer can replace the fixed multi-round symposium with orchestrated
all-member dispatch plus adaptive follow-up. The default
:meth:run_symposium uses the hardened :class:AgentSymposiumEnvironment
so member failures are contained rather than fatal.
Source code in src/ursa/workflows/hypothesis_symposium.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | |
ainvestigate_hypothesis(hypothesis, query, config)
async
¶
Async investigation hook; defaults to the sync implementation.
Source code in src/ursa/workflows/hypothesis_symposium.py
build_hypotheses(state, config)
¶
Produce competing hypotheses via the HypothesizerAgent.
The hypothesizer maintains a durable markdown artifact whose competing
hypotheses are ### H... lines; those become the fan-out branches.
Source code in src/ursa/workflows/hypothesis_symposium.py
converge(state, config)
¶
Fan-in: assemble the per-hypothesis findings into one digest.
Source code in src/ursa/workflows/hypothesis_symposium.py
format_result(result)
¶
Return only the final write-up, not the whole state.
Prefers the symposium's detailed final answer and falls back to the
shorter synthesized summary when the symposium produced no final
text (for example if the stage was skipped).
Source code in src/ursa/workflows/hypothesis_symposium.py
investigate_hypothesis(hypothesis, query, config)
¶
Default synchronous investigation (assignment record).
In the default design (A) the substantive per-hypothesis
investigation is performed by the symposium member that owns this
hypothesis (during the symposium's initial-work phase), so this fan-out
branch only records the assignment that will be handed to that member.
This keeps the fan-out / quarantine / fan-in plumbing intact as the
Plan D seam: a subclass can override this (or
:meth:ainvestigate_hypothesis) to dispatch a dedicated investigation
agent per branch instead of (or in addition to) the symposium.
Source code in src/ursa/workflows/hypothesis_symposium.py
run_symposium(state, config)
async
¶
Cross-review + multi-round revision over the collected evidence.
The default symposium assigns one member per hypothesis (design A): each member investigates its own hypothesis during initial work, then reads every member's investigation during review to adjudicate which hypothesis the combined evidence best supports. Isolated behind this hook so a Plan D layer can swap the fixed loop for orchestrated all-member dispatch + adaptive follow-up. The underlying environment is the hardened symposium (member failures are contained).
Source code in src/ursa/workflows/hypothesis_symposium.py
synthesize(state, config)
async
¶
Turn the symposium result into a final verdict string.
Source code in src/ursa/workflows/hypothesis_symposium.py
update_hypothesis_space(state, config)
async
¶
Fold ALL new information back into the durable hypothesis space.
Source code in src/ursa/workflows/hypothesis_symposium.py
PlanningExecutionAgent
¶
Bases: BaseAgent[PlanExecuteState]
Plan a task and execute each plan step in one persistent graph.
The agent uses one underlying LLM for planning, reflection, tool-driven
execution, review, and recap. Both child agents are compiled with
checkpointer=True so they inherit the parent agent's
checkpointer and receive LangGraph-managed nested checkpoint namespaces.
max_reflection_steps configures the planner. All remaining keyword
arguments are the normal :class:ExecutionAgent / :class:BaseAgent
options, including workspace, tools, persistence, thread, telemetry, and
retention settings.
Source code in src/ursa/workflows/planning_execution_workflow.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
PlanningExecutorWorkflow
¶
Bases: BaseWorkflow
Deprecated two-agent planning/execution loop.
This preserves the original planner= / executor= constructor and
string return value. New code should use :class:PlanningExecutionAgent,
which composes its child agents into a persistent LangGraph.
Source code in src/ursa/workflows/planning_execution_workflow.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
SimulationUseWorkflow
¶
Bases: BaseWorkflow
Deprecated simulator-schema-aware planning/execution loop.
Source code in src/ursa/workflows/simulation_use_workflow.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
SpawnInvestigatorInput
¶
Bases: BaseModel
Input schema for the spawn_investigator orchestrator tool.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
ThinkPlanningExecutionAgent
¶
Bases: PlanningExecutionAgent
Build, investigate, and revise a durable hypothesis space.
One parent runtime adapts URSA's hypothesizer, planner, and executor agents into checkpointed child nodes. The hypothesizer first initializes or updates its durable hypothesis space from the current user request. The planner then creates a plan guided by that space, the executor performs each step, and the resulting summaries return to the hypothesizer as new evidence.
Source code in src/ursa/workflows/think_plan_execute.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
think_plan_execute_workflow(llm, **agent_kwargs)
¶
Create a persistent hypothesis-plan-execute-update parent agent.
Source code in src/ursa/workflows/think_plan_execute.py
base_workflow
¶
Base workflow class providing telemetry and execution abstractions.
This module defines the BaseWorkflow abstract class, which serves as the foundation for all workflow implementations in the URSA framework. It provides:
- Telemetry and metrics collection
- Thread and checkpoint management
- Input normalization and validation
- Execution flow control with invoke methods
- Graph integration utilities for LangGraph compatibility
- Runtime enforcement of the agent interface contract
Workflows built on this base class benefit from consistent behavior, observability, and integration capabilities while only needing to implement the core _invoke method.
BaseWorkflow
¶
Bases: ABC
Abstract base class for all workflow implementations in the URSA framework.
BaseWorkflow provides a standardized foundation for building workflows consisting of LLM-powered agents with built-in telemetry, configuration management, and execution flow control. It handles common tasks like input normalization, thread management, metrics collection, and LangGraph integration.
Subclasses only need to implement the _invoke method to define their core functionality, while inheriting standardized invocation patterns, telemetry, and graph integration capabilities. The class enforces a consistent interface through runtime checks that prevent subclasses from overriding critical methods like invoke().
The agent supports direct invocation with inputs, with automatic tracking of token usage, execution time, and other metrics. It also provides utilities for integrating with LangGraph through node wrapping and configuration.
Subclass Inheritance Guidelines
- Must Override: _invoke() - Define your agent's core functionality
- Can Override: _normalize_inputs() - Customize input handling Various helper methods
- Never Override: invoke() - Final method with runtime enforcement call() - Delegates to invoke Other public methods (build_config, write_state, add_node)
To create a custom agent, inherit from this class and implement the _invoke method:
class MyWorkflow(BaseWorkflow):
def _invoke(self, inputs: Mapping[str, Any], **config: Any) -> Any:
# Process inputs and return results
...
Source code in src/ursa/workflows/base_workflow.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
__call__(inputs, /, **kwargs)
¶
__init_subclass__(**kwargs)
¶
Ensure subclass does not override key method.
Source code in src/ursa/workflows/base_workflow.py
ainvoke(inputs=None, /, *, config=None, **kwargs)
async
¶
Asynchronously execute the workflow with normalized inputs.
Subclasses can provide a native async implementation by overriding
_ainvoke. The default _ainvoke implementation runs the sync
_invoke implementation in a worker thread.
Source code in src/ursa/workflows/base_workflow.py
invoke(inputs=None, /, *, config=None, **kwargs)
¶
Executes the agent with the provided inputs and configuration.
This is the main entry point for agent execution. It handles input normalization, telemetry tracking, and proper execution context management. The method supports flexible input formats - either as a positional argument or as keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Optional[InputLike]
|
Optional positional input to the agent. If provided, all non-control keyword arguments will be rejected to avoid ambiguity. |
None
|
config
|
Optional[dict]
|
Optional configuration dictionary to override default settings. |
None
|
**kwargs
|
Any
|
Additional keyword arguments that can be either: - Input parameters (when no positional input is provided) - Control parameters recognized by the agent |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The result of the agent's execution. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If both positional inputs and non-control keyword arguments are provided simultaneously. |
Source code in src/ursa/workflows/base_workflow.py
hypothesis_orchestrator
¶
Sub-agent orchestrator variant of the hypothesis workflow (Plan D).
This workflow is a dynamic-topology counterpart to
:class:~ursa.workflows.hypothesis_symposium.HypothesisSymposiumWorkflow. It is
built for empirical comparison: instead of a fixed fan-out + symposium graph, an
orchestrating agent is given tools to spawn persistent, per-hypothesis
investigation agents on demand, then task each of them with reviewing the
others.
Design:
build_hypothesesruns the :class:HypothesizerAgentto produce the hypothesis space (same as the symposium workflow).- A run-scoped :class:
_InvestigatorRegistrymints a timestamped persistentagent_nameper hypothesis (mirroring theursa save-agenttimestamp convention%Y%m%d_%H%M%S). Timestamping guarantees uniqueness across concurrent dashboard runs; caching by hypothesis label guarantees the same agent both investigates a hypothesis and later reviews the others, so it accumulates durable memory across phases. - The orchestrator is an :class:
ExecutionAgentgiven two extra tools:spawn_investigator(create-or-reuse a persistent investigator and invoke it) andlist_investigators(recall minted identities). The orchestrator is prompted to record the minted identities in its experiences and to avoid calling the same investigator twice in one parallel batch of tool calls. - Each investigator works in its own private sub-workspace, but before every
delegation its peers' workspaces are symlinked under
peers/<label>/inside it. That lets the review round read peers' real artifacts instead of only the summary text, while the write-tool sandbox keeps those paths read-only.
Observability/testability is deliberately weaker than the static symposium graph (dynamic topology), which is the expected tradeoff for adaptive orchestration.
HypothesisOrchestratorWorkflow
¶
Bases: WorkflowToolsMixin, BaseWorkflow
Hypothesize, then let an orchestrator spawn/review per-hypothesis agents.
A dynamic-topology alternative to
:class:~ursa.workflows.hypothesis_symposium.HypothesisSymposiumWorkflow,
intended for empirical comparison. Every scientific phase is exposed as an
overridable hook.
Because the topology is dynamic there is no environment object to hand to
run_with_visualization, so this workflow records its own environment run:
it opens an :func:environment_run_recorder for the whole orchestration and
threads the resulting run config into both the orchestrator agent and every
spawned investigator. That captures (a) explicit orchestrator->investigator
delegation events emitted here and (b) all structured events emitted by the
sub-agents themselves, streamed live to events.jsonl. Delegation traffic
is additionally rendered to the stdout logs so progress is visible without a
dashboard.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | |
build_hypotheses(query, context, config)
¶
Produce competing hypotheses via the HypothesizerAgent.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
format_result(result)
¶
Return only the final write-up, not the whole state.
The full state carries bulky intermediate data (raw orchestrator result,
parsed hypotheses, the hypothesis-space markdown, investigator
identities). Returning all of it makes the dashboard output unreadable,
so surface just the detailed final answer, falling back to summary
if a subclass produced one instead.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
SpawnInvestigatorInput
¶
Bases: BaseModel
Input schema for the spawn_investigator orchestrator tool.
Source code in src/ursa/workflows/hypothesis_orchestrator.py
hypothesis_symposium
¶
Hypothesis-driven symposium workflow (Plan A).
This workflow builds a durable hypothesis space, fans out one investigation branch per competing hypothesis, converges the per-hypothesis findings, runs a symposium-style cross-review / multi-round revision over the collected evidence, synthesizes a verdict, and finally folds every piece of new information back into the hypothesis space.
Design goals baked into the structure:
- The multi-round symposium loop is deliberately isolated behind overridable
hooks (:meth:
build_hypotheses, :meth:investigate_hypothesis, :meth:converge, :meth:run_symposium, :meth:synthesize, :meth:update_hypothesis_space). A future Plan D layer can subclass this workflow and replace :meth:run_symposiumwith orchestrated all-member dispatch plus adaptive follow-up without touching the fan-out plumbing. - Per-hypothesis investigation is quarantined: an exception in one branch is captured as recorded failure data (via a reducer channel) instead of aborting the run, so healthy sibling branches and downstream review survive.
Hypothesis
dataclass
¶
One competing hypothesis to investigate.
Source code in src/ursa/workflows/_hypotheses.py
HypothesisInvestigation
dataclass
¶
Recorded outcome of a single (quarantined) investigation branch.
Source code in src/ursa/workflows/hypothesis_symposium.py
HypothesisSymposiumState
¶
Bases: TypedDict
Parent graph state.
Fan-in requires reducer channels, so investigation results and failures use
operator.add accumulators. Overwrite([]) resets them between phases.
Source code in src/ursa/workflows/hypothesis_symposium.py
HypothesisSymposiumWorkflow
¶
Bases: WorkflowToolsMixin, BaseWorkflow
Hypothesize -> fan out -> investigate -> converge -> review -> update.
Every scientific phase is exposed as an overridable hook so a later Plan D
layer can replace the fixed multi-round symposium with orchestrated
all-member dispatch plus adaptive follow-up. The default
:meth:run_symposium uses the hardened :class:AgentSymposiumEnvironment
so member failures are contained rather than fatal.
Source code in src/ursa/workflows/hypothesis_symposium.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | |
ainvestigate_hypothesis(hypothesis, query, config)
async
¶
Async investigation hook; defaults to the sync implementation.
Source code in src/ursa/workflows/hypothesis_symposium.py
build_hypotheses(state, config)
¶
Produce competing hypotheses via the HypothesizerAgent.
The hypothesizer maintains a durable markdown artifact whose competing
hypotheses are ### H... lines; those become the fan-out branches.
Source code in src/ursa/workflows/hypothesis_symposium.py
converge(state, config)
¶
Fan-in: assemble the per-hypothesis findings into one digest.
Source code in src/ursa/workflows/hypothesis_symposium.py
format_result(result)
¶
Return only the final write-up, not the whole state.
Prefers the symposium's detailed final answer and falls back to the
shorter synthesized summary when the symposium produced no final
text (for example if the stage was skipped).
Source code in src/ursa/workflows/hypothesis_symposium.py
investigate_hypothesis(hypothesis, query, config)
¶
Default synchronous investigation (assignment record).
In the default design (A) the substantive per-hypothesis
investigation is performed by the symposium member that owns this
hypothesis (during the symposium's initial-work phase), so this fan-out
branch only records the assignment that will be handed to that member.
This keeps the fan-out / quarantine / fan-in plumbing intact as the
Plan D seam: a subclass can override this (or
:meth:ainvestigate_hypothesis) to dispatch a dedicated investigation
agent per branch instead of (or in addition to) the symposium.
Source code in src/ursa/workflows/hypothesis_symposium.py
run_symposium(state, config)
async
¶
Cross-review + multi-round revision over the collected evidence.
The default symposium assigns one member per hypothesis (design A): each member investigates its own hypothesis during initial work, then reads every member's investigation during review to adjudicate which hypothesis the combined evidence best supports. Isolated behind this hook so a Plan D layer can swap the fixed loop for orchestrated all-member dispatch + adaptive follow-up. The underlying environment is the hardened symposium (member failures are contained).
Source code in src/ursa/workflows/hypothesis_symposium.py
synthesize(state, config)
async
¶
Turn the symposium result into a final verdict string.
Source code in src/ursa/workflows/hypothesis_symposium.py
update_hypothesis_space(state, config)
async
¶
Fold ALL new information back into the durable hypothesis space.
Source code in src/ursa/workflows/hypothesis_symposium.py
planning_execution_workflow
¶
Persistent workflow for planning and stepwise execution.
The parent owns the LangGraph runtime, checkpointer, store, and thread. Separate
PlanningAgent and ExecutionAgent instances are adapted into checkpointed
child nodes with narrow state contracts.
PlanExecuteState
¶
Bases: TypedDict
Parent orchestration state for planning and stepwise execution.
Source code in src/ursa/workflows/planning_execution_workflow.py
PlanningExecutionAgent
¶
Bases: BaseAgent[PlanExecuteState]
Plan a task and execute each plan step in one persistent graph.
The agent uses one underlying LLM for planning, reflection, tool-driven
execution, review, and recap. Both child agents are compiled with
checkpointer=True so they inherit the parent agent's
checkpointer and receive LangGraph-managed nested checkpoint namespaces.
max_reflection_steps configures the planner. All remaining keyword
arguments are the normal :class:ExecutionAgent / :class:BaseAgent
options, including workspace, tools, persistence, thread, telemetry, and
retention settings.
Source code in src/ursa/workflows/planning_execution_workflow.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
PlanningExecutorWorkflow
¶
Bases: BaseWorkflow
Deprecated two-agent planning/execution loop.
This preserves the original planner= / executor= constructor and
string return value. New code should use :class:PlanningExecutionAgent,
which composes its child agents into a persistent LangGraph.
Source code in src/ursa/workflows/planning_execution_workflow.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
message_text(message)
¶
Return plain text content from a message-like value.
Source code in src/ursa/workflows/planning_execution_workflow.py
simulation_use_workflow
¶
Deprecated planner/executor workflow specialized for simulator schemas.
SimulationUseWorkflow
¶
Bases: BaseWorkflow
Deprecated simulator-schema-aware planning/execution loop.
Source code in src/ursa/workflows/simulation_use_workflow.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
think_plan_execute
¶
Think-plan-execute composite using URSA's hypothesis-space behavior.
ThinkPlanExecuteState
¶
Bases: PlanExecuteState, HypothesizerState
Parent state shared with the planner, executor, and hypothesizer.
Source code in src/ursa/workflows/think_plan_execute.py
ThinkPlanningExecutionAgent
¶
Bases: PlanningExecutionAgent
Build, investigate, and revise a durable hypothesis space.
One parent runtime adapts URSA's hypothesizer, planner, and executor agents into checkpointed child nodes. The hypothesizer first initializes or updates its durable hypothesis space from the current user request. The planner then creates a plan guided by that space, the executor performs each step, and the resulting summaries return to the hypothesizer as new evidence.
Source code in src/ursa/workflows/think_plan_execute.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
think_plan_execute_workflow(llm, **agent_kwargs)
¶
Create a persistent hypothesis-plan-execute-update parent agent.