Core Models
Core Models
Fundamental Pydantic models representing the workflow state machine.
Workflow
High-level container for tasks, resources, agents, and governance constraints.
Bases: BaseModel
Source code in manager_agent_gym/schemas/core/workflow.py
21 22 23 24 25 26 27 28 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 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 | |
model_config = ConfigDict(arbitrary_types_allowed=True)
class-attribute
instance-attribute
A complete workflow containing tasks, agents, and execution state.
This represents the core environment for the Manager Agent POSG.
total_budget: float
property
Sum of estimated costs across all tasks and nested subtasks.
total_expected_hours: float
property
Sum of estimated duration hours across all tasks and nested subtasks.
workflow_id: UUID
property
Alias for id field to maintain compatibility.
add_agent(agent: AgentInterface) -> None
Add an agent to the workflow.
Source code in manager_agent_gym/schemas/core/workflow.py
159 160 161 | |
add_resource(resource: Resource) -> None
Add a resource to the workflow.
Source code in manager_agent_gym/schemas/core/workflow.py
142 143 144 | |
add_task(task: Task) -> None
Add a task to the workflow.
Source code in manager_agent_gym/schemas/core/workflow.py
138 139 140 | |
find_task_by_id(task_id: UUID) -> Task | None
Find a task by ID in the workflow.
Source code in manager_agent_gym/schemas/core/workflow.py
251 252 253 254 255 256 257 258 259 260 261 | |
get_all_resources() -> list[Resource]
Return all resources currently registered in the workflow.
Source code in manager_agent_gym/schemas/core/workflow.py
155 156 157 | |
get_available_agents() -> list[AgentInterface]
Get agents that are currently available for task assignment.
Source code in manager_agent_gym/schemas/core/workflow.py
247 248 249 | |
get_ready_tasks() -> list[Task]
Get atomic tasks that are ready to start (all dependencies satisfied).
Recursively considers leaf subtasks and ensures they are registered as executable tasks so downstream systems can schedule and update them.
Source code in manager_agent_gym/schemas/core/workflow.py
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 | |
get_task_dependencies_graph() -> dict[UUID, list[UUID]]
Get the task dependency graph as adjacency list.
Source code in manager_agent_gym/schemas/core/workflow.py
270 271 272 273 274 | |
get_task_output_resources(task: Task) -> list[Resource]
Return realized output resources for a given task by id lookup.
Source code in manager_agent_gym/schemas/core/workflow.py
146 147 148 149 150 151 152 153 | |
is_complete() -> bool
Check if all atomic tasks in the workflow are completed.
Source code in manager_agent_gym/schemas/core/workflow.py
263 264 265 266 267 268 | |
pretty_print(include_resources: bool = True, max_preview_chars: int = 300) -> str
Return a human-readable summary of the workflow, tasks, and selected resources.
Source code in manager_agent_gym/schemas/core/workflow.py
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 | |
validate_task_graph() -> bool
Validate that the task graph is executable.
Checks: - No cycles in the effective atomic dependency graph - All referenced dependencies exist in the workflow - The effective atomic-task dependency graph has at least one start and is acyclic (i.e., the workflow is completable without deadlock)
Source code in manager_agent_gym/schemas/core/workflow.py
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 | |
Task
Individual work items with dependencies, status, and assignment metadata.
Bases: BaseModel
A task in the workflow system.
Tasks represent atomic units of work that can be assigned to agents. They form nodes in the task dependency graph (G in the POSG state).
Source code in manager_agent_gym/schemas/core/tasks.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 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 | |
task_id: UUID
property
Alias for id field to maintain compatibility.
add_subtask(subtask: Task) -> None
Add a subtask and set its parent reference.
Source code in manager_agent_gym/schemas/core/tasks.py
148 149 150 151 | |
calculate_coordination_deadtime_seconds() -> float
Calculate coordination deadtime for this task in seconds.
Deadtime = max(0, start_time - deps_ready_time) Returns 0.0 if timestamps are not available.
Returns:
| Type | Description |
|---|---|
float
|
Coordination deadtime in seconds |
Source code in manager_agent_gym/schemas/core/tasks.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
find_task_by_id(task_id: UUID) -> Task | None
Find a task by ID in this task tree.
Source code in manager_agent_gym/schemas/core/tasks.py
164 165 166 167 168 169 170 171 172 | |
get_all_subtasks_flat() -> list[Task]
Get all subtasks in a flat list (recursive).
Source code in manager_agent_gym/schemas/core/tasks.py
130 131 132 133 134 135 136 | |
get_atomic_subtasks() -> list[Task]
Get only the atomic (leaf) subtasks.
Source code in manager_agent_gym/schemas/core/tasks.py
138 139 140 141 142 143 144 145 146 | |
is_atomic_task() -> bool
Check if this task has no subtasks (atomic task).
Source code in manager_agent_gym/schemas/core/tasks.py
126 127 128 | |
is_composite_task() -> bool
Check if this task has subtasks (composite task).
Source code in manager_agent_gym/schemas/core/tasks.py
106 107 108 | |
is_ready_to_start(completed_task_ids: set[UUID]) -> bool
Check if all dependencies are satisfied.
Source code in manager_agent_gym/schemas/core/tasks.py
102 103 104 | |
pretty_print(indent: int = 0) -> str
Return a human-readable summary of the task and selected fields.
Source code in manager_agent_gym/schemas/core/tasks.py
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 | |
remove_subtask(subtask_id: UUID) -> bool
Remove a subtask by ID. Returns True if found and removed.
Source code in manager_agent_gym/schemas/core/tasks.py
153 154 155 156 157 158 159 160 161 162 | |
sync_embedded_tasks_with_registry(task_registry: dict[UUID, Task]) -> None
Synchronize embedded subtasks with the authoritative task registry.
This fixes the bug where embedded subtasks become stale when the registry is updated. Recursively updates all embedded subtasks to match their registry counterparts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_registry
|
dict[UUID, Task]
|
Dictionary mapping task IDs to authoritative Task objects |
required |
Source code in manager_agent_gym/schemas/core/tasks.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
Resource
Artifacts produced or consumed by tasks while a workflow executes.
Bases: BaseModel
Workflow resource model.
Represents inputs/outputs of tasks: documents, datasets, artifacts, code snippets, and other digital assets (R in the POSG state).
Example
Resource(
name="Stakeholder Brief v1",
description="Two-page summary for exec review",
content="...",
content_type="text/markdown",
)
Source code in manager_agent_gym/schemas/core/resources.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 | |
resource_id: UUID
property
Alias for id field to maintain compatibility.
pretty_print(max_preview_chars: int = 5000) -> str
Return a human-readable summary of the resource with a safe content preview.
Source code in manager_agent_gym/schemas/core/resources.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
Message
Structured communications exchanged between agents and stakeholders.
Bases: BaseModel
A communication message in the system.
Messages form part of the communication history (C in the POSG state). Enhanced with thread support, multiple recipients, and read tracking.
Source code in manager_agent_gym/schemas/core/communication.py
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 | |
get_all_recipients() -> set[str]
Get all recipients including primary receiver.
Source code in manager_agent_gym/schemas/core/communication.py
134 135 136 137 138 139 | |
is_broadcast() -> bool
Check if this is a broadcast message.
Source code in manager_agent_gym/schemas/core/communication.py
130 131 132 | |
mark_read_by(agent_id: str) -> None
Mark this message as read by an agent.
Source code in manager_agent_gym/schemas/core/communication.py
126 127 128 | |
validate_content(v: str) -> str
classmethod
Validate message content is not empty.
Source code in manager_agent_gym/schemas/core/communication.py
112 113 114 115 116 117 118 | |
validate_recipients(v: list[str]) -> list[str]
classmethod
Ensure recipient list has unique values.
Source code in manager_agent_gym/schemas/core/communication.py
120 121 122 123 124 | |