base_team
Class info¶
Classes¶
Name | Children | Inherits |
---|---|---|
AgentsManifest llmling_agent.models.manifest Complete agent configuration manifest defining all available agents. |
||
AggregatedMessageStats llmling_agent.talk.stats Statistics aggregated from multiple connections. |
||
AggregatedTalkStats llmling_agent.talk.stats Statistics aggregated from multiple connections. |
||
BaseTeam llmling_agent.delegation.base_team Base class for Team and TeamRun. |
||
MessageNode llmling_agent.messaging.messagenode Base class for all message processing nodes. |
||
NodeContext llmling_agent.messaging.context NodeContext(*, node_name: 'str', pool: 'AgentPool | None' \= None, config: 'NodeConfig', definition: 'AgentsManifest', current_prompt: 'str | None' \= None, in_async_context: 'bool' \= False, input_provider: 'InputProvider | None' \= None) |
||
TeamConfig llmling_agent.models.teams Configuration for a team or chain of message nodes. |
||
TeamContext llmling_agent.delegation.base_team TeamContext(*, node_name: 'str', pool: 'AgentPool | None' \= None, config: 'TeamConfig', definition: 'AgentsManifest', current_prompt: 'str | None' \= None, in_async_context: 'bool' \= False, input_provider: 'InputProvider | None' \= None) |
🛈 DocStrings¶
BaseTeam
¶
Bases: MessageNode[TDeps, TResult]
Base class for Team and TeamRun.
Source code in src/llmling_agent/delegation/base_team.py
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 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 |
|
context
property
writable
¶
context: TeamContext
Get shared pool from team members.
Raises:
Type | Description |
---|---|
ValueError
|
If team members belong to different pools |
__and__
¶
Combine teams, preserving type safety for same types.
Source code in src/llmling_agent/delegation/base_team.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
__getitem__
¶
__getitem__(index_or_name: int | str) -> MessageNode[TDeps, TResult]
Get team member by index or name.
Source code in src/llmling_agent/delegation/base_team.py
163 164 165 166 167 |
|
__init__
¶
__init__(
agents: Sequence[MessageNode[TDeps, TResult]],
*,
name: str | None = None,
description: str | None = None,
shared_prompt: str | None = None,
mcp_servers: list[str | MCPServerConfig] | None = None,
picker: AnyAgent[Any, Any] | None = None,
num_picks: int | None = None,
pick_prompt: str | None = None,
)
Common variables only for typing.
Source code in src/llmling_agent/delegation/base_team.py
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 |
|
__iter__
¶
__iter__() -> Iterator[MessageNode[TDeps, TResult]]
Iterate over team members.
Source code in src/llmling_agent/delegation/base_team.py
159 160 161 |
|
__len__
¶
__len__() -> int
Get number of team members.
Source code in src/llmling_agent/delegation/base_team.py
155 156 157 |
|
__or__
¶
__or__(
other: AnyAgent[Any, Any] | ProcessorCallback[Any] | BaseTeam[Any, Any],
) -> TeamRun[Any, Any]
Create a sequential pipeline.
Source code in src/llmling_agent/delegation/base_team.py
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 |
|
__repr__
¶
__repr__() -> str
Create readable representation.
Source code in src/llmling_agent/delegation/base_team.py
149 150 151 152 153 |
|
_on_node_added
¶
_on_node_added(index: int, node: MessageNode[Any, Any])
Handler for adding nodes to the team.
Source code in src/llmling_agent/delegation/base_team.py
130 131 132 133 134 135 |
|
_on_node_changed
¶
_on_node_changed(index: int, old: MessageNode, new: MessageNode)
Handle node replacement in the agents list.
Source code in src/llmling_agent/delegation/base_team.py
125 126 127 128 |
|
_on_node_removed
¶
_on_node_removed(index: int, node: MessageNode[Any, Any])
Handler for removing nodes from the team.
Source code in src/llmling_agent/delegation/base_team.py
141 142 143 144 145 146 |
|
cancel
async
¶
cancel()
Cancel execution and cleanup.
Source code in src/llmling_agent/delegation/base_team.py
321 322 323 324 325 |
|
distribute
async
¶
distribute(
content: str,
*,
tools: list[str] | None = None,
resources: list[str] | None = None,
metadata: dict[str, Any] | None = None,
)
Distribute content and capabilities to all team members.
Source code in src/llmling_agent/delegation/base_team.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
|
get_structure_diagram
¶
get_structure_diagram() -> str
Generate mermaid flowchart of node hierarchy.
Source code in src/llmling_agent/delegation/base_team.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
is_busy
¶
is_busy() -> bool
Check if team is processing any tasks.
Source code in src/llmling_agent/delegation/base_team.py
242 243 244 |
|
iter_agents
¶
Recursively iterate over all child agents.
Source code in src/llmling_agent/delegation/base_team.py
351 352 353 354 355 356 357 358 359 360 361 362 363 |
|
pick_agents
async
¶
pick_agents(task: str) -> Sequence[MessageNode[Any, Any]]
Pick agents to run.
Source code in src/llmling_agent/delegation/base_team.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
run_in_background
async
¶
run_in_background(
*prompts: AnyPromptType | Image | PathLike[str] | None,
max_count: int | None = 1,
interval: float = 1.0,
**kwargs: Any,
) -> ExtendedTeamTalk
Start execution in background.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompts
|
AnyPromptType | Image | PathLike[str] | None
|
Prompts to execute |
()
|
max_count
|
int | None
|
Maximum number of executions (None = run indefinitely) |
1
|
interval
|
float
|
Seconds between executions |
1.0
|
**kwargs
|
Any
|
Additional args for execute() |
{}
|
Source code in src/llmling_agent/delegation/base_team.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 |
|
run_sync
¶
run_sync(
*prompt: AnyPromptType | Image | PathLike[str], store_history: bool = True
) -> ChatMessage[TResult]
Run agent synchronously (convenience wrapper).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt
|
AnyPromptType | Image | PathLike[str]
|
User query or instruction |
()
|
store_history
|
bool
|
Whether the message exchange should be added to the context window |
True
|
Returns: Result containing response and run information
Source code in src/llmling_agent/delegation/base_team.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
|
stop
async
¶
stop()
Stop background execution if running.
Source code in src/llmling_agent/delegation/base_team.py
246 247 248 249 250 251 252 |
|
temporary_state
async
¶
temporary_state(
*,
system_prompts: list[AnyPromptType] | None = None,
replace_prompts: bool = False,
tools: list[ToolType] | None = None,
replace_tools: bool = False,
history: list[AnyPromptType] | SessionQuery | None = None,
replace_history: bool = False,
pause_routing: bool = False,
model: ModelType | None = None,
provider: AgentProvider | None = None,
) -> AsyncIterator[Self]
Temporarily modify state of all agents in the team.
All agents in the team will enter their temporary state simultaneously.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
system_prompts
|
list[AnyPromptType] | None
|
Temporary system prompts to use |
None
|
replace_prompts
|
bool
|
Whether to replace existing prompts |
False
|
tools
|
list[ToolType] | None
|
Temporary tools to make available |
None
|
replace_tools
|
bool
|
Whether to replace existing tools |
False
|
history
|
list[AnyPromptType] | SessionQuery | None
|
Conversation history (prompts or query) |
None
|
replace_history
|
bool
|
Whether to replace existing history |
False
|
pause_routing
|
bool
|
Whether to pause message routing |
False
|
model
|
ModelType | None
|
Temporary model override |
None
|
provider
|
AgentProvider | None
|
Temporary provider override |
None
|
Source code in src/llmling_agent/delegation/base_team.py
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 |
|
wait
async
¶
wait() -> ChatMessage[Any] | None
Wait for background execution to complete and return last message.
Source code in src/llmling_agent/delegation/base_team.py
254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
TeamContext
dataclass
¶
Bases: NodeContext[TDeps]
Source code in src/llmling_agent/delegation/base_team.py
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 |
|
create_default
classmethod
¶
create_default(
name: str,
mode: Literal["sequential", "parallel"] = "sequential",
pool: AgentPool | None = None,
) -> TeamContext
Create a default agent context with minimal privileges.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the agent |
required |
mode
|
Literal['sequential', 'parallel']
|
Execution mode (sequential or parallel) |
'sequential'
|
pool
|
AgentPool | None
|
(optional): Optional pool the agent is part of |
None
|
Source code in src/llmling_agent/delegation/base_team.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|