llmling_agent
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| Agent llmling_agent.agent.agent The main agent class. |
||
| AgentConfig llmling_agent.models.agents Configuration for a single agent in the system. |
|
|
| AgentContext llmling_agent.agent.context Runtime context for agent execution. |
||
| AgentPool llmling_agent.delegation.pool Pool managing message processing nodes (agents and teams). |
||
| AgentsManifest llmling_agent.models.manifest Complete agent configuration manifest defining all available agents. |
||
| AudioBase64Content llmling_agent.models.content Audio from base64 data. |
||
| AudioURLContent llmling_agent.models.content Audio from URL. |
||
| BaseTeam llmling_agent.delegation.base_team Base class for Team and TeamRun. |
||
| ChatMessage llmling_agent.messaging.messages Common message format for all UI types. |
||
| ImageBase64Content llmling_agent.models.content Image from base64 data. |
||
| ImageURLContent llmling_agent.models.content Image from URL. |
||
| MessageNode llmling_agent.messaging.messagenode Base class for all message processing nodes. |
||
| PDFBase64Content llmling_agent.models.content PDF from base64 data. |
||
| PDFURLContent llmling_agent.models.content PDF from URL. |
||
| Team llmling_agent.delegation.team Group of agents that can execute together. |
||
| TeamRun llmling_agent.delegation.teamrun Handles team operations with monitoring. |
||
| Tool llmling_agent.tools.base Information about a registered tool. |
||
| ToolCallInfo llmling_agent.tools.tool_call_info Information about an executed tool call. |
||
| VideoURLContent llmling_agent.models.content Video from URL. |
🛈 DocStrings¶
LLMling-Agent: main package.
A pydantic-ai based Agent with LLMling backend.
Agent
¶
Bases: MessageNode[TDeps, OutputDataT]
The main agent class.
Generically typed with: LLMLingAgent[Type of Dependencies, Type of Result]
Source code in src/llmling_agent/agent/agent.py
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 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 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 | |
AgentReset
dataclass
¶
Emitted when agent is reset.
Source code in src/llmling_agent/agent/agent.py
116 117 118 119 120 121 122 123 | |
__aenter__
async
¶
__aenter__() -> Self
Enter async context and set up MCP servers.
Source code in src/llmling_agent/agent/agent.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
__aexit__
async
¶
__aexit__(
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None
Exit async context.
Source code in src/llmling_agent/agent/agent.py
328 329 330 331 332 333 334 335 | |
__and__
¶
Create sequential team using & operator.
Example
group = analyzer & planner & executor # Create group of 3 group = analyzer & existing_group # Add to existing group
Source code in src/llmling_agent/agent/agent.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
__init__
¶
__init__(
name: str = "llmling-agent",
*,
deps_type: type[TDeps] | None = None,
model: ModelType = None,
output_type: OutputSpec[OutputDataT] = str,
session: SessionIdType | SessionQuery | MemoryConfig | bool | int = None,
system_prompt: AnyPromptType | Sequence[AnyPromptType] = (),
description: str | None = None,
tools: Sequence[ToolType | Tool] | None = None,
toolsets: Sequence[ResourceProvider] | None = None,
mcp_servers: Sequence[str | MCPServerConfig] | None = None,
resources: Sequence[PromptType | str] = (),
skills_paths: Sequence[JoinablePathLike] | None = None,
retries: int = 1,
output_retries: int | None = None,
end_strategy: EndStrategy = "early",
input_provider: InputProvider | None = None,
parallel_init: bool = True,
debug: bool = False,
event_handlers: Sequence[IndividualEventHandler] | None = None,
agent_pool: AgentPool[Any] | None = None,
tool_mode: ToolMode | None = None,
knowledge: Knowledge | None = None,
agent_config: AgentConfig | None = None
) -> None
Initialize agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the agent for logging and identification |
'llmling-agent'
|
deps_type
|
type[TDeps] | None
|
Type of dependencies to use |
None
|
model
|
ModelType
|
The default model to use (defaults to GPT-5) |
None
|
output_type
|
OutputSpec[OutputDataT]
|
The default output type to use (defaults to str) |
str
|
context
|
Agent context with configuration |
required | |
session
|
SessionIdType | SessionQuery | MemoryConfig | bool | int
|
Memory configuration. - None: Default memory config - False: Disable message history (max_messages=0) - int: Max tokens for memory - str/UUID: Session identifier - MemoryConfig: Full memory configuration - MemoryProvider: Custom memory provider - SessionQuery: Session query |
None
|
system_prompt
|
AnyPromptType | Sequence[AnyPromptType]
|
System prompts for the agent |
()
|
description
|
str | None
|
Description of the Agent ("what it can do") |
None
|
tools
|
Sequence[ToolType | Tool] | None
|
List of tools to register with the agent |
None
|
toolsets
|
Sequence[ResourceProvider] | None
|
List of toolset resource providers for the agent |
None
|
mcp_servers
|
Sequence[str | MCPServerConfig] | None
|
MCP servers to connect to |
None
|
resources
|
Sequence[PromptType | str]
|
Additional resources to load |
()
|
skills_paths
|
Sequence[JoinablePathLike] | None
|
Local directories to search for agent-specific skills |
None
|
retries
|
int
|
Default number of retries for failed operations |
1
|
output_retries
|
int | None
|
Max retries for result validation (defaults to retries) |
None
|
end_strategy
|
EndStrategy
|
Strategy for handling tool calls that are requested alongside a final result |
'early'
|
input_provider
|
InputProvider | None
|
Provider for human input (tool confirmation / HumanProviders) |
None
|
parallel_init
|
bool
|
Whether to initialize resources in parallel |
True
|
debug
|
bool
|
Whether to enable debug mode |
False
|
event_handlers
|
Sequence[IndividualEventHandler] | None
|
Sequence of event handlers to register with the agent |
None
|
agent_pool
|
AgentPool[Any] | None
|
AgentPool instance for managing agent resources |
None
|
tool_mode
|
ToolMode | None
|
Tool execution mode (None or "codemode") |
None
|
knowledge
|
Knowledge | None
|
Knowledge sources for this agent |
None
|
agent_config
|
AgentConfig | None
|
Agent configuration |
None
|
Source code in src/llmling_agent/agent/agent.py
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 | |
from_callback
classmethod
¶
from_callback(
callback: ProcessorCallback[TResult], *, name: str | None = None, **kwargs: Any
) -> Agent[None, TResult]
Create an agent from a processing callback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
ProcessorCallback[TResult]
|
Function to process messages. Can be: - sync or async - with or without context - must return str for pipeline compatibility |
required |
name
|
str | None
|
Optional name for the agent |
None
|
kwargs
|
Any
|
Additional arguments for agent |
{}
|
Source code in src/llmling_agent/agent/agent.py
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 | |
get_agentlet
async
¶
get_agentlet(
tool_choice: str | list[str] | None,
model: ModelType,
output_type: type[AgentOutputType] | None,
deps_type: type[AgentDepsType] | None = None,
input_provider: InputProvider | None = None,
) -> Agent[AgentDepsType, AgentOutputType]
Create pydantic-ai agent from current state.
Source code in src/llmling_agent/agent/agent.py
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 | |
get_stats
async
¶
get_stats() -> MessageStats
Get message statistics (async version).
Source code in src/llmling_agent/agent/agent.py
1084 1085 1086 1087 | |
is_busy
¶
is_busy() -> bool
Check if agent is currently processing tasks.
Source code in src/llmling_agent/agent/agent.py
462 463 464 | |
register_worker
¶
register_worker(
worker: MessageNode[Any, Any],
*,
name: str | None = None,
reset_history_on_run: bool = True,
pass_message_history: bool = False
) -> Tool
Register another agent as a worker tool.
Source code in src/llmling_agent/agent/agent.py
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | |
reset
async
¶
reset() -> None
Reset agent state (conversation history and tool states).
Source code in src/llmling_agent/agent/agent.py
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | |
run
async
¶
run(
*prompts: PromptCompatible | ChatMessage[Any],
output_type: None = None,
model: ModelType = None,
store_history: bool = True,
tool_choice: str | list[str] | None = None,
usage_limits: UsageLimits | None = None,
message_id: str | None = None,
conversation_id: str | None = None,
messages: list[ChatMessage[Any]] | None = None,
message_history: MessageHistory | None = None,
deps: TDeps | None = None,
input_provider: InputProvider | None = None,
wait_for_connections: bool | None = None
) -> ChatMessage[OutputDataT]
run(
*prompts: PromptCompatible | ChatMessage[Any],
output_type: type[OutputTypeT],
model: ModelType = None,
store_history: bool = True,
tool_choice: str | list[str] | None = None,
usage_limits: UsageLimits | None = None,
message_id: str | None = None,
conversation_id: str | None = None,
message_history: MessageHistory | None = None,
deps: TDeps | None = None,
input_provider: InputProvider | None = None,
wait_for_connections: bool | None = None
) -> ChatMessage[OutputTypeT]
run(
*prompts: PromptCompatible | ChatMessage[Any],
output_type: type[Any] | None = None,
model: ModelType = None,
store_history: bool = True,
tool_choice: str | list[str] | None = None,
usage_limits: UsageLimits | None = None,
message_id: str | None = None,
conversation_id: str | None = None,
message_history: MessageHistory | None = None,
deps: TDeps | None = None,
input_provider: InputProvider | None = None,
wait_for_connections: bool | None = None
) -> ChatMessage[Any]
Run agent with prompt and get response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompts
|
PromptCompatible | ChatMessage[Any]
|
User query or instruction |
()
|
output_type
|
type[Any] | None
|
Optional type for structured responses |
None
|
model
|
ModelType
|
Optional model override |
None
|
store_history
|
bool
|
Whether the message exchange should be added to the context window |
True
|
tool_choice
|
str | list[str] | None
|
Filter tool choice by name |
None
|
usage_limits
|
UsageLimits | None
|
Optional usage limits for the model |
None
|
message_id
|
str | None
|
Optional message id for the returned message. Automatically generated if not provided. |
None
|
conversation_id
|
str | None
|
Optional conversation id for the returned message. |
None
|
messages
|
Optional list of messages to replace the conversation history |
required | |
message_history
|
MessageHistory | None
|
Optional MessageHistory object to use instead of agent's own conversation |
None
|
deps
|
TDeps | None
|
Optional dependencies for the agent |
None
|
input_provider
|
InputProvider | None
|
Optional input provider for the agent |
None
|
wait_for_connections
|
bool | None
|
Whether to wait for connected agents to complete |
None
|
Returns:
| Type | Description |
|---|---|
ChatMessage[Any]
|
Result containing response and run information |
Raises:
| Type | Description |
|---|---|
UnexpectedModelBehavior
|
If the model fails or behaves unexpectedly |
Source code in src/llmling_agent/agent/agent.py
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 | |
run_in_background
async
¶
run_in_background(
*prompt: PromptCompatible, max_count: int | None = None, interval: float = 1.0, **kwargs: Any
) -> Task[ChatMessage[OutputDataT] | None]
Run agent continuously in background with prompt or dynamic prompt function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
PromptCompatible
|
Static prompt or function that generates prompts |
()
|
max_count
|
int | None
|
Maximum number of runs (None = infinite) |
None
|
interval
|
float
|
Seconds between runs |
1.0
|
**kwargs
|
Any
|
Arguments passed to run() |
{}
|
Source code in src/llmling_agent/agent/agent.py
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | |
run_iter
async
¶
run_iter(
*prompt_groups: Sequence[PromptCompatible],
output_type: type[OutputDataT] | None = None,
model: ModelType = None,
store_history: bool = True,
wait_for_connections: bool | None = None
) -> AsyncIterator[ChatMessage[OutputDataT]]
Run agent sequentially on multiple prompt groups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_groups
|
Sequence[PromptCompatible]
|
Groups of prompts to process sequentially |
()
|
output_type
|
type[OutputDataT] | None
|
Optional type for structured responses |
None
|
model
|
ModelType
|
Optional model override |
None
|
store_history
|
bool
|
Whether to store in conversation history |
True
|
wait_for_connections
|
bool | None
|
Whether to wait for connected agents |
None
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[ChatMessage[OutputDataT]]
|
Response messages in sequence |
Example
questions = [ ["What is your name?"], ["How old are you?", image1], ["Describe this image", image2], ] async for response in agent.run_iter(*questions): print(response.content)
Source code in src/llmling_agent/agent/agent.py
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | |
run_job
async
¶
run_job(
job: Job[TDeps, str | None], *, store_history: bool = True, include_agent_tools: bool = True
) -> ChatMessage[OutputDataT]
Execute a pre-defined task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
Job[TDeps, str | None]
|
Job configuration to execute |
required |
store_history
|
bool
|
Whether the message exchange should be added to the context window |
True
|
include_agent_tools
|
bool
|
Whether to include agent tools |
True
|
Returns: Job execution result
Raises:
| Type | Description |
|---|---|
JobError
|
If task execution fails |
ValueError
|
If task configuration is invalid |
Source code in src/llmling_agent/agent/agent.py
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | |
run_stream
async
¶
run_stream(
*prompt: PromptCompatible,
output_type: type[OutputDataT] | None = None,
model: ModelType = None,
tool_choice: str | list[str] | None = None,
store_history: bool = True,
usage_limits: UsageLimits | None = None,
message_id: str | None = None,
conversation_id: str | None = None,
messages: list[ChatMessage[Any]] | None = None,
input_provider: InputProvider | None = None,
wait_for_connections: bool | None = None,
deps: TDeps | None = None
) -> AsyncIterator[RichAgentStreamEvent[OutputDataT]]
Run agent with prompt and get a streaming response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
PromptCompatible
|
User query or instruction |
()
|
output_type
|
type[OutputDataT] | None
|
Optional type for structured responses |
None
|
model
|
ModelType
|
Optional model override |
None
|
tool_choice
|
str | list[str] | None
|
Filter tool choice by name |
None
|
store_history
|
bool
|
Whether the message exchange should be added to the context window |
True
|
usage_limits
|
UsageLimits | None
|
Optional usage limits for the model |
None
|
message_id
|
str | None
|
Optional message id for the returned message. Automatically generated if not provided. |
None
|
conversation_id
|
str | None
|
Optional conversation id for the returned message. |
None
|
messages
|
list[ChatMessage[Any]] | None
|
Optional list of messages to replace the conversation history |
None
|
input_provider
|
InputProvider | None
|
Optional input provider for the agent |
None
|
wait_for_connections
|
bool | None
|
Whether to wait for connected agents to complete |
None
|
deps
|
TDeps | None
|
Optional dependencies for the agent |
None
|
Returns: An async iterator yielding streaming events with final message embedded.
Raises:
| Type | Description |
|---|---|
UnexpectedModelBehavior
|
If the model fails or behaves unexpectedly |
Source code in src/llmling_agent/agent/agent.py
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 | |
set_model
¶
set_model(model: ModelType) -> None
Set the model for this agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ModelType
|
New model to use (name or instance) |
required |
Source code in src/llmling_agent/agent/agent.py
1061 1062 1063 1064 1065 1066 1067 1068 | |
share
async
¶
share(
target: Agent[TDeps, Any],
*,
tools: list[str] | None = None,
history: bool | int | None = None,
token_limit: int | None = None
) -> None
Share capabilities and knowledge with another agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Agent[TDeps, Any]
|
Agent to share with |
required |
tools
|
list[str] | None
|
List of tool names to share |
None
|
history
|
bool | int | None
|
Share conversation history: - True: Share full history - int: Number of most recent messages to share - None: Don't share history |
None
|
token_limit
|
int | None
|
Optional max tokens for history |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If requested items don't exist |
RuntimeError
|
If runtime not available for resources |
Source code in src/llmling_agent/agent/agent.py
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | |
stop
async
¶
stop() -> None
Stop continuous execution if running.
Source code in src/llmling_agent/agent/agent.py
985 986 987 988 989 990 | |
temporary_state
async
¶
temporary_state(
*,
system_prompts: list[AnyPromptType] | None = None,
output_type: type[T] | 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
) -> AsyncIterator[Self | Agent[T]]
Temporarily modify agent state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system_prompts
|
list[AnyPromptType] | None
|
Temporary system prompts to use |
None
|
output_type
|
type[T] | None
|
Temporary output type 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
|
Source code in src/llmling_agent/agent/agent.py
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | |
to_structured
¶
to_structured(
output_type: type[NewOutputDataT],
*,
tool_name: str | None = None,
tool_description: str | None = None
) -> Agent[TDeps, NewOutputDataT]
Convert this agent to a structured agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_type
|
type[NewOutputDataT]
|
Type for structured responses. Can be: - A Python type (Pydantic model) |
required |
tool_name
|
str | None
|
Optional override for result tool name |
None
|
tool_description
|
str | None
|
Optional override for result tool description |
None
|
Returns:
| Type | Description |
|---|---|
Agent[TDeps, NewOutputDataT]
|
Typed Agent |
Source code in src/llmling_agent/agent/agent.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
to_tool
¶
to_tool(
*,
name: str | None = None,
reset_history_on_run: bool = True,
pass_message_history: bool = False,
parent: Agent[Any, Any] | None = None
) -> Tool[OutputDataT]
Create a tool from this agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Optional tool name override |
None
|
reset_history_on_run
|
bool
|
Clear agent's history before each run |
True
|
pass_message_history
|
bool
|
Pass parent's message history to agent |
False
|
parent
|
Agent[Any, Any] | None
|
Optional parent agent for history/context sharing |
None
|
Source code in src/llmling_agent/agent/agent.py
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 | |
validate_against
async
¶
Check if agent's response satisfies stricter criteria.
Source code in src/llmling_agent/agent/agent.py
1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 | |
wait
async
¶
wait() -> ChatMessage[OutputDataT]
Wait for background execution to complete.
Source code in src/llmling_agent/agent/agent.py
992 993 994 995 996 997 998 999 1000 1001 1002 1003 | |
AgentConfig
¶
Bases: NodeConfig
Configuration for a single agent in the system.
Defines an agent's complete configuration including its model, environment, and behavior settings.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/agent_configuration/
Source code in src/llmling_agent/models/agents.py
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 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 | |
avatar
class-attribute
instance-attribute
¶
avatar: str | None = Field(
default=None,
examples=["https://example.com/avatar.png", "/assets/robot.jpg"],
title="Avatar image",
)
URL or path to agent's avatar image
config_file_path
class-attribute
instance-attribute
¶
config_file_path: str | None = Field(
default=None,
examples=["/path/to/config.yml", "configs/agent.yaml"],
title="Configuration file path",
)
Config file path for resolving environment.
debug
class-attribute
instance-attribute
¶
debug: bool = Field(default=False, title='Debug mode')
Enable debug output for this agent.
end_strategy
class-attribute
instance-attribute
¶
end_strategy: EndStrategy = Field(
default="early", examples=["early", "exhaust"], title="Tool execution strategy"
)
The strategy for handling multiple tool calls when a final result is found
inherits
class-attribute
instance-attribute
¶
inherits: str | None = Field(default=None, title='Inheritance source')
Name of agent config to inherit from
knowledge
class-attribute
instance-attribute
¶
knowledge: Knowledge | None = Field(
default=None,
title="Knowledge sources",
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/knowledge_configuration/"
},
)
Knowledge sources for this agent.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/knowledge_configuration/
model
class-attribute
instance-attribute
¶
model: str | ModelName | AnyModelConfig | None = Field(
default=None,
examples=["openai:gpt-5-nano"],
title="Model configuration or name",
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/model_configuration/"
},
)
The model to use for this agent. Can be either a simple model name string (e.g. 'openai:gpt-5') or a structured model definition.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/model_configuration/
output_retries
class-attribute
instance-attribute
¶
output_retries: int | None = Field(default=None, examples=[1, 3], title='Output retries')
Max retries for result validation
output_type
class-attribute
instance-attribute
¶
output_type: str | StructuredResponseConfig | None = Field(
default=None,
examples=["json_response", "code_output"],
title="Response type",
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/response_configuration/"
},
)
Name of the response definition to use.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/response_configuration/
requires_tool_confirmation
class-attribute
instance-attribute
¶
requires_tool_confirmation: ToolConfirmationMode = Field(
default="per_tool", examples=["always", "never", "per_tool"], title="Tool confirmation mode"
)
How to handle tool confirmation: - "always": Always require confirmation for all tools - "never": Never require confirmation (ignore tool settings) - "per_tool": Use individual tool settings
retries
class-attribute
instance-attribute
¶
retries: int = Field(default=1, ge=0, examples=[1, 3], title='Model retries')
Number of retries for failed operations (maps to pydantic-ai's retries)
session
class-attribute
instance-attribute
¶
session: str | SessionQuery | MemoryConfig | None = Field(
default=None,
examples=["main_session", "user_123"],
title="Session configuration",
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/session_configuration/"
},
)
Session configuration for conversation recovery.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/session_configuration/
system_prompts
class-attribute
instance-attribute
¶
system_prompts: Sequence[str | PromptConfig] = Field(
default_factory=list,
title="System prompts",
examples=[["You are an AI assistant."]],
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/system_prompts_configuration/"
},
)
System prompts for the agent. Can be strings or structured prompt configs.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/system_prompts_configuration/
tool_mode
class-attribute
instance-attribute
¶
tool_mode: ToolMode | None = Field(default=None, examples=["codemode"], title="Tool execution mode")
Tool execution mode: - None: Default mode - tools are called directly - "codemode": Tools are wrapped in a Python execution environment
tools
class-attribute
instance-attribute
¶
tools: list[ToolConfig | str] = Field(
default_factory=list,
examples=[
["webbrowser:open", "builtins:print"],
[{"type": "import", "import_path": "webbrowser:open", "name": "web_browser"}],
],
title="Tool configurations",
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/tool_configuration/"
},
)
A list of tools to register with this agent.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/tool_configuration/
toolsets
class-attribute
instance-attribute
¶
toolsets: list[ToolsetConfig] = Field(
default_factory=list,
examples=[
[
{"type": "openapi", "spec": "https://api.example.com/openapi.json", "namespace": "api"},
{"type": "file_access"},
{"type": "composio", "user_id": "user123@example.com", "toolsets": ["github", "slack"]},
]
],
title="Toolset configurations",
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/toolset_configuration/"
},
)
Toolset configurations for extensible tool collections.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/toolset_configuration/
usage_limits
class-attribute
instance-attribute
¶
usage_limits: UsageLimits | None = Field(default=None, title='Usage limits')
Usage limits for this agent.
workers
class-attribute
instance-attribute
¶
workers: list[WorkerConfig] = Field(
default_factory=list,
examples=[
[{"type": "agent", "name": "web_agent", "reset_history_on_run": True}],
[{"type": "team", "name": "analysis_team"}],
],
title="Worker agents",
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/worker_configuration/"
},
)
Worker agents which will be available as tools.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/worker_configuration/
get_session_config
¶
get_session_config() -> MemoryConfig
Get resolved memory configuration.
Source code in src/llmling_agent/models/agents.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
get_system_prompts
¶
get_system_prompts() -> list[BasePrompt]
Get all system prompts as BasePrompts.
Source code in src/llmling_agent/models/agents.py
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 | |
get_tool_provider
¶
get_tool_provider() -> ResourceProvider | None
Get tool provider for this agent.
Source code in src/llmling_agent/models/agents.py
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 | |
get_toolsets
¶
get_toolsets() -> list[ResourceProvider]
Get all resource providers for this agent.
Source code in src/llmling_agent/models/agents.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
handle_model_types
classmethod
¶
Convert model inputs to appropriate format.
Source code in src/llmling_agent/models/agents.py
289 290 291 292 293 294 295 | |
is_structured
¶
is_structured() -> bool
Check if this config defines a structured agent.
Source code in src/llmling_agent/models/agents.py
259 260 261 | |
render_system_prompts
¶
Render system prompts with context.
Source code in src/llmling_agent/models/agents.py
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 | |
validate_output_type
classmethod
¶
Convert result type and apply its settings.
Source code in src/llmling_agent/models/agents.py
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 | |
AgentContext
dataclass
¶
Bases: NodeContext[TDeps]
Runtime context for agent execution.
Generically typed with AgentContext[Type of Dependencies]
Source code in src/llmling_agent/agent/context.py
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 | |
tool_call_id
class-attribute
instance-attribute
¶
tool_call_id: str | None = None
ID of the current tool call.
tool_input
class-attribute
instance-attribute
¶
Input arguments for the current tool call.
tool_name
class-attribute
instance-attribute
¶
tool_name: str | None = None
Name of the currently executing tool.
handle_confirmation
async
¶
Handle tool execution confirmation.
Returns True if: - No confirmation handler is set - Handler confirms the execution
Source code in src/llmling_agent/agent/context.py
55 56 57 58 59 60 61 62 63 64 65 66 67 | |
handle_elicitation
async
¶
handle_elicitation(params: ElicitRequestParams) -> ElicitResult | ErrorData
Handle elicitation request for additional information.
Source code in src/llmling_agent/agent/context.py
69 70 71 72 73 74 75 | |
report_progress
async
¶
Report progress by emitting event into the agent's stream.
Source code in src/llmling_agent/agent/context.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
AgentPool
¶
Bases: BaseRegistry[NodeName, MessageNode[Any, Any]]
Pool managing message processing nodes (agents and teams).
Acts as a unified registry for all nodes, providing: - Centralized node management and lookup - Shared dependency injection - Connection management - Resource coordination
Nodes can be accessed through: - nodes: All registered nodes (agents and teams) - agents: Only Agent instances - teams: Only Team instances
Source code in src/llmling_agent/delegation/pool.py
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 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 | |
__aenter__
async
¶
__aenter__() -> Self
Enter async context and initialize all agents.
Source code in src/llmling_agent/delegation/pool.py
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 | |
__aexit__
async
¶
__aexit__(
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None
Exit async context.
Source code in src/llmling_agent/delegation/pool.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
__init__
¶
__init__(
manifest: JoinablePathLike | AgentsManifest | None = None,
*,
shared_deps_type: type[TPoolDeps] | None = None,
connect_nodes: bool = True,
input_provider: InputProvider | None = None,
parallel_load: bool = True,
event_handlers: list[IndividualEventHandler] | None = None
)
Initialize agent pool with immediate agent creation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
JoinablePathLike | AgentsManifest | None
|
Agent configuration manifest |
None
|
shared_deps_type
|
type[TPoolDeps] | None
|
Dependencies to share across all nodes |
None
|
connect_nodes
|
bool
|
Whether to set up forwarding connections |
True
|
input_provider
|
InputProvider | None
|
Input provider for tool / step confirmations / HumanAgents |
None
|
parallel_load
|
bool
|
Whether to load nodes in parallel (async) |
True
|
event_handlers
|
list[IndividualEventHandler] | None
|
Event handlers to pass through to all agents |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If manifest contains invalid node configurations |
RuntimeError
|
If node initialization fails |
Source code in src/llmling_agent/delegation/pool.py
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 | |
add_agent
async
¶
add_agent(
name: AgentName, *, output_type: OutputSpec[TResult] = str, **kwargs: Unpack[AgentKwargs]
) -> Agent[Any, TResult]
Add a new permanent agent to the pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
AgentName
|
Name for the new agent |
required |
output_type
|
OutputSpec[TResult]
|
Optional type for structured responses: |
str
|
**kwargs
|
Unpack[AgentKwargs]
|
Additional agent configuration |
{}
|
Returns:
| Type | Description |
|---|---|
Agent[Any, TResult]
|
An agent instance |
Source code in src/llmling_agent/delegation/pool.py
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 | |
cleanup
async
¶
cleanup() -> None
Clean up all agents.
Source code in src/llmling_agent/delegation/pool.py
217 218 219 220 221 222 | |
create_team
¶
create_team(
agents: Sequence[AgentName | MessageNode[Any, Any]] | None = None,
*,
name: str | None = None,
description: str | None = None,
shared_prompt: str | None = None,
picker: Agent[Any, Any] | None = None,
num_picks: int | None = None,
pick_prompt: str | None = None
) -> Team[Any]
Create a group from agent names or instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agents
|
Sequence[AgentName | MessageNode[Any, Any]] | None
|
List of agent names or instances (all if None) |
None
|
name
|
str | None
|
Optional name for the team |
None
|
description
|
str | None
|
Optional description for the team |
None
|
shared_prompt
|
str | None
|
Optional prompt for all agents |
None
|
picker
|
Agent[Any, Any] | None
|
Agent to use for picking agents |
None
|
num_picks
|
int | None
|
Number of agents to pick |
None
|
pick_prompt
|
str | None
|
Prompt to use for picking agents |
None
|
Source code in src/llmling_agent/delegation/pool.py
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 | |
create_team_run
¶
create_team_run(
agents: Sequence[str],
validator: MessageNode[Any, TResult] | None = None,
*,
name: str | None = None,
description: str | None = None,
shared_prompt: str | None = None,
picker: Agent[Any, Any] | None = None,
num_picks: int | None = None,
pick_prompt: str | None = None
) -> TeamRun[TPoolDeps, TResult]
create_team_run(
agents: Sequence[MessageNode[TDeps, Any]],
validator: MessageNode[Any, TResult] | None = None,
*,
name: str | None = None,
description: str | None = None,
shared_prompt: str | None = None,
picker: Agent[Any, Any] | None = None,
num_picks: int | None = None,
pick_prompt: str | None = None
) -> TeamRun[TDeps, TResult]
create_team_run(
agents: Sequence[AgentName | MessageNode[Any, Any]],
validator: MessageNode[Any, TResult] | None = None,
*,
name: str | None = None,
description: str | None = None,
shared_prompt: str | None = None,
picker: Agent[Any, Any] | None = None,
num_picks: int | None = None,
pick_prompt: str | None = None
) -> TeamRun[Any, TResult]
create_team_run(
agents: Sequence[AgentName | MessageNode[Any, Any]] | None = None,
validator: MessageNode[Any, TResult] | None = None,
*,
name: str | None = None,
description: str | None = None,
shared_prompt: str | None = None,
picker: Agent[Any, Any] | None = None,
num_picks: int | None = None,
pick_prompt: str | None = None
) -> TeamRun[Any, TResult]
Create a a sequential TeamRun from a list of Agents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agents
|
Sequence[AgentName | MessageNode[Any, Any]] | None
|
List of agent names or team/agent instances (all if None) |
None
|
validator
|
MessageNode[Any, TResult] | None
|
Node to validate the results of the TeamRun |
None
|
name
|
str | None
|
Optional name for the team |
None
|
description
|
str | None
|
Optional description for the team |
None
|
shared_prompt
|
str | None
|
Optional prompt for all agents |
None
|
picker
|
Agent[Any, Any] | None
|
Agent to use for picking agents |
None
|
num_picks
|
int | None
|
Number of agents to pick |
None
|
pick_prompt
|
str | None
|
Prompt to use for picking agents |
None
|
Source code in src/llmling_agent/delegation/pool.py
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 | |
get_agent
¶
get_agent(
agent: AgentName | Agent[Any, str],
*,
deps_type: Any | None = None,
return_type: Any = str,
model_override: ModelName | str | None = None,
session: SessionIdType | SessionQuery = None
) -> Agent[Any, Any]
Get or configure an agent from the pool.
This method provides flexible agent configuration with dependency injection: - Without deps: Agent uses pool's shared dependencies - With deps: Agent uses provided custom dependencies
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
AgentName | Agent[Any, str]
|
Either agent name or instance |
required |
deps_type
|
Any | None
|
Optional custom dependencies type (overrides shared deps) |
None
|
return_type
|
Any
|
Optional type for structured responses |
str
|
model_override
|
ModelName | str | None
|
Optional model override |
None
|
session
|
SessionIdType | SessionQuery
|
Optional session ID or query to recover conversation |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Either |
Agent[Any, Any]
|
|
Agent[Any, Any]
|
|
|
Agent[Any, Any]
|
|
Raises:
| Type | Description |
|---|---|
KeyError
|
If agent name not found |
ValueError
|
If configuration is invalid |
Source code in src/llmling_agent/delegation/pool.py
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 | |
get_mermaid_diagram
¶
Generate mermaid flowchart of all agents and their connections.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_details
|
bool
|
Whether to show connection details (types, queues, etc) |
True
|
Source code in src/llmling_agent/delegation/pool.py
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 | |
list_nodes
¶
List available agent names.
Source code in src/llmling_agent/delegation/pool.py
600 601 602 | |
run_event_loop
async
¶
run_event_loop() -> None
Run pool in event-watching mode until interrupted.
Source code in src/llmling_agent/delegation/pool.py
395 396 397 398 399 400 401 402 403 | |
setup_agent_workers
¶
Set up workers for an agent from configuration.
Source code in src/llmling_agent/delegation/pool.py
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | |
track_message_flow
async
¶
track_message_flow() -> AsyncIterator[MessageFlowTracker]
Track message flow during a context.
Source code in src/llmling_agent/delegation/pool.py
385 386 387 388 389 390 391 392 393 | |
AgentsManifest
¶
Bases: Schema
Complete agent configuration manifest defining all available agents.
This is the root configuration that: - Defines available response types (both inline and imported) - Configures all agent instances and their settings - Sets up custom role definitions and capabilities - Manages environment configurations
A single manifest can define multiple agents that can work independently or collaborate through the orchestrator.
Source code in src/llmling_agent/models/manifest.py
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 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 | |
INHERIT
class-attribute
instance-attribute
¶
Inheritance references.
agents
class-attribute
instance-attribute
¶
agents: dict[str, AgentConfig] = Field(
default_factory=dict,
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/agent_configuration/"
},
)
Mapping of agent IDs to their configurations.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/agent_configuration/
commands
class-attribute
instance-attribute
¶
commands: dict[str, CommandConfig | str] = Field(
default_factory=dict,
examples=[
{"check_disk": "df -h", "analyze": "Analyze the current situation"},
{"status": {"type": "static", "content": "Show system status"}},
],
)
Global command shortcuts for prompt injection.
Supports both shorthand string syntax and full command configurations
commands: df: "check disk space" # shorthand -> StaticCommandConfig analyze: # full config type: file path: "./prompts/analysis.md"
conversion
class-attribute
instance-attribute
¶
conversion: ConversionConfig = Field(default_factory=ConversionConfig)
Document conversion configuration.
jobs
class-attribute
instance-attribute
¶
Pre-defined jobs, ready to be used by nodes.
mcp_servers
class-attribute
instance-attribute
¶
mcp_servers: list[str | MCPServerConfig] = Field(
default_factory=list,
examples=[["uvx some-server"], [{"type": "streamable-http", "url": "http://mcp.example.com"}]],
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/mcp_configuration/"
},
)
List of MCP server configurations:
These MCP servers are used to provide tools and other resources to the nodes.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/mcp_configuration/
observability
class-attribute
instance-attribute
¶
observability: ObservabilityConfig = Field(default_factory=ObservabilityConfig)
Observability provider configuration.
pool_server
class-attribute
instance-attribute
¶
pool_server: MCPPoolServerConfig = Field(default_factory=MCPPoolServerConfig)
Pool server configuration.
This MCP server configuration is used for the pool MCP server, which exposes pool functionality to other applications / clients.
prompt_manager
cached
property
¶
prompt_manager: PromptManager
Get prompt manager for this manifest.
prompts
class-attribute
instance-attribute
¶
prompts: PromptLibraryConfig = Field(
default_factory=PromptLibraryConfig,
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/prompt_configuration/"
},
)
Prompt library configuration.
This configuration defines the prompt library, which is used to provide prompts to the nodes.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/prompt_configuration/
resources
class-attribute
instance-attribute
¶
resources: dict[str, ResourceConfig | str] = Field(
default_factory=dict,
examples=[
{"docs": "file://./docs", "data": "s3://bucket/data"},
{"api": {"type": "source", "uri": "https://api.example.com", "cached": True}},
],
)
Resource configurations defining available filesystems.
Supports both full config and URI shorthand
resources: docs: "file://./docs" # shorthand data: # full config type: "source" uri: "s3://bucket/data" cached: true
responses
class-attribute
instance-attribute
¶
responses: dict[str, StructuredResponseConfig] = Field(
default_factory=dict,
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/response_configuration/"
},
)
Mapping of response names to their definitions.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/response_configuration/
storage
class-attribute
instance-attribute
¶
storage: StorageConfig = Field(
default_factory=StorageConfig,
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/storage_configuration/"
},
)
Storage provider configuration.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/storage_configuration/
teams
class-attribute
instance-attribute
¶
teams: dict[str, TeamConfig] = Field(
default_factory=dict,
json_schema_extra={
"documentation_url": "https://phil65.github.io/llmling-agent/YAML%20Configuration/team_configuration/"
},
)
Mapping of team IDs to their configurations.
Docs: https://phil65.github.io/llmling-agent/YAML%20Configuration/team_configuration/
vfs_registry
cached
property
¶
vfs_registry: VFSRegistry
Get registry with all configured VFS resources.
clone_agent_config
¶
clone_agent_config(
name: str,
new_name: str | None = None,
*,
template_context: dict[str, Any] | None = None,
**overrides: Any
) -> str
Create a copy of an agent configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of agent to clone |
required |
new_name
|
str | None
|
Optional new name (auto-generated if None) |
None
|
template_context
|
dict[str, Any] | None
|
Variables for template rendering |
None
|
**overrides
|
Any
|
Configuration overrides for the clone |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Name of the new agent |
Raises:
| Type | Description |
|---|---|
KeyError
|
If original agent not found |
ValueError
|
If new name already exists or if overrides invalid |
Source code in src/llmling_agent/models/manifest.py
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 | |
from_file
classmethod
¶
from_file(path: JoinablePathLike) -> Self
Load agent configuration from YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
JoinablePathLike
|
Path to the configuration file |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Loaded agent definition |
Raises:
| Type | Description |
|---|---|
ValueError
|
If loading fails |
Source code in src/llmling_agent/models/manifest.py
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 | |
get_command_configs
¶
Get processed command configurations.
Converts string entries to StaticCommandConfig instances.
Returns:
| Type | Description |
|---|---|
dict[str, CommandConfig]
|
Dict mapping command names to CommandConfig instances |
Source code in src/llmling_agent/models/manifest.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
get_mcp_servers
¶
get_mcp_servers() -> list[MCPServerConfig]
Get processed MCP server configurations.
Converts string entries to appropriate MCP server configs based on heuristics: - URLs ending with "/sse" -> SSE server - URLs starting with http(s):// -> HTTP server - Everything else -> stdio command
Returns:
| Type | Description |
|---|---|
list[MCPServerConfig]
|
List of MCPServerConfig instances |
Raises:
| Type | Description |
|---|---|
ValueError
|
If string entry is empty |
Source code in src/llmling_agent/models/manifest.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
get_output_type
¶
Get the resolved result type for an agent.
Returns None if no result type is configured.
Source code in src/llmling_agent/models/manifest.py
557 558 559 560 561 562 563 564 565 566 567 568 569 | |
normalize_workers
classmethod
¶
Convert string workers to appropriate WorkerConfig for all agents.
Source code in src/llmling_agent/models/manifest.py
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 | |
resolve_inheritance
classmethod
¶
Resolve agent inheritance chains.
Source code in src/llmling_agent/models/manifest.py
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 | |
AudioBase64Content
¶
Bases: AudioContent
Audio from base64 data.
Source code in src/llmling_agent/models/content.py
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 | |
type
class-attribute
instance-attribute
¶
type: Literal['audio_base64'] = Field('audio_base64', init=False)
Base64-encoded audio.
from_bytes
classmethod
¶
Create from raw bytes.
Source code in src/llmling_agent/models/content.py
250 251 252 253 | |
from_path
classmethod
¶
from_path(path: JoinablePathLike) -> Self
Create from file path with auto format detection.
Source code in src/llmling_agent/models/content.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
AudioURLContent
¶
Bases: AudioContent
Audio from URL.
Source code in src/llmling_agent/models/content.py
221 222 223 224 225 226 227 228 229 230 231 | |
BaseTeam
¶
Bases: MessageNode[TDeps, TResult]
Base class for Team and TeamRun.
Source code in src/llmling_agent/delegation/base_team.py
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 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 | |
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
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
__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
177 178 179 180 181 | |
__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: Agent[Any, Any] | None = None,
num_picks: int | None = None,
pick_prompt: str | None = None
) -> None
Common variables only for typing.
Source code in src/llmling_agent/delegation/base_team.py
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 | |
__iter__
¶
__iter__() -> Iterator[MessageNode[TDeps, TResult]]
Iterate over team members.
Source code in src/llmling_agent/delegation/base_team.py
173 174 175 | |
__len__
¶
__len__() -> int
Get number of team members.
Source code in src/llmling_agent/delegation/base_team.py
169 170 171 | |
__or__
¶
Create a sequential pipeline.
Source code in src/llmling_agent/delegation/base_team.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
__repr__
¶
__repr__() -> str
Create readable representation.
Source code in src/llmling_agent/delegation/base_team.py
163 164 165 166 167 | |
cancel
async
¶
cancel() -> None
Cancel execution and cleanup.
Source code in src/llmling_agent/delegation/base_team.py
327 328 329 330 331 | |
distribute
async
¶
distribute(
content: str,
*,
tools: list[str] | None = None,
resources: list[str] | None = None,
metadata: dict[str, Any] | None = None
) -> None
Distribute content and capabilities to all team members.
Source code in src/llmling_agent/delegation/base_team.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
get_stats
async
¶
get_stats() -> AggregatedMessageStats
Get aggregated stats from all team members.
Source code in src/llmling_agent/delegation/base_team.py
238 239 240 241 | |
get_structure_diagram
¶
get_structure_diagram() -> str
Generate mermaid flowchart of node hierarchy.
Source code in src/llmling_agent/delegation/base_team.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
is_busy
¶
is_busy() -> bool
Check if team is processing any tasks.
Source code in src/llmling_agent/delegation/base_team.py
248 249 250 | |
iter_agents
¶
Recursively iterate over all child agents.
Source code in src/llmling_agent/delegation/base_team.py
357 358 359 360 361 362 363 364 365 366 367 368 369 | |
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
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
run_in_background
async
¶
run_in_background(
*prompts: PromptCompatible | None,
max_count: int | None = 1,
interval: float = 1.0,
**kwargs: Any
) -> ExtendedTeamTalk
Start execution in background.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompts
|
PromptCompatible | 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
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 | |
stop
async
¶
stop() -> None
Stop background execution if running.
Source code in src/llmling_agent/delegation/base_team.py
252 253 254 255 256 257 258 | |
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
) -> 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
|
Source code in src/llmling_agent/delegation/base_team.py
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 | |
to_tool
¶
Create a tool from this agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Optional tool name override |
None
|
description
|
str | None
|
Optional tool description override |
None
|
Source code in src/llmling_agent/delegation/base_team.py
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 | |
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
260 261 262 263 264 265 266 267 268 269 270 271 272 | |
ChatMessage
dataclass
¶
Common message format for all UI types.
Generically typed with: ChatMessage[Type of Content] The type can either be str or a BaseModel subclass.
Source code in src/llmling_agent/messaging/messages.py
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 | |
associated_messages
class-attribute
instance-attribute
¶
associated_messages: list[ChatMessage[Any]] = field(default_factory=list)
List of messages which were generated during the the creation of this messsage.
content
instance-attribute
¶
content: TContent
Message content, typed as TContent (either str or BaseModel).
conversation_id
class-attribute
instance-attribute
¶
conversation_id: str | None = None
ID of the conversation this message belongs to.
cost_info
class-attribute
instance-attribute
¶
cost_info: TokenCost | None = None
Token usage and costs for this specific message if available.
finish_reason
class-attribute
instance-attribute
¶
finish_reason: FinishReason | None = None
Reason the model finished generating the response.
Normalized to OpenTelemetry values.
forwarded_from
class-attribute
instance-attribute
¶
List of agent names (the chain) that forwarded this message to the sender.
last_message
property
¶
last_message: ModelMessage | None
Return the last message from the message history.
message_id
class-attribute
instance-attribute
¶
Unique identifier for this message.
messages
class-attribute
instance-attribute
¶
List of messages which were generated during the the creation of this messsage.
metadata
class-attribute
instance-attribute
¶
Additional metadata about the message.
model_name
class-attribute
instance-attribute
¶
model_name: str | None = None
The name of the model that generated the response.
name
class-attribute
instance-attribute
¶
name: str | None = None
Display name for the message sender in UI.
parts
property
¶
The parts of the last model message.
provider_details
class-attribute
instance-attribute
¶
Provider specific metadata / extra information.
provider_name
class-attribute
instance-attribute
¶
provider_name: str | None = None
The name of the LLM provider that generated the response.
provider_response_id
class-attribute
instance-attribute
¶
provider_response_id: str | None = None
request ID as specified by the model provider.
This can be used to track the specific request to the model.
response_time
class-attribute
instance-attribute
¶
response_time: float | None = None
Time it took the LLM to respond.
timestamp
class-attribute
instance-attribute
¶
When this message was created.
usage
class-attribute
instance-attribute
¶
usage: RequestUsage = field(default_factory=RequestUsage)
Usage information for the request.
This has a default to make tests easier, and to support loading old messages where usage will be missing.
format
¶
format(
style: FormatStyle = "simple",
*,
template: str | None = None,
variables: dict[str, Any] | None = None,
show_metadata: bool = False,
show_costs: bool = False
) -> str
Format message with configurable style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
FormatStyle
|
Predefined style or "custom" for custom template |
'simple'
|
template
|
str | None
|
Custom Jinja template (required if style="custom") |
None
|
variables
|
dict[str, Any] | None
|
Additional variables for template rendering |
None
|
show_metadata
|
bool
|
Whether to include metadata |
False
|
show_costs
|
bool
|
Whether to include cost information |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If style is "custom" but no template provided or if style is invalid |
Source code in src/llmling_agent/messaging/messages.py
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 | |
forwarded
¶
forwarded(previous_message: ChatMessage[Any]) -> Self
Create new message showing it was forwarded from another message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
previous_message
|
ChatMessage[Any]
|
The message that led to this one's creation |
required |
Returns:
| Type | Description |
|---|---|
Self
|
New message with updated chain showing the path through previous message |
Source code in src/llmling_agent/messaging/messages.py
399 400 401 402 403 404 405 406 407 408 409 | |
from_pydantic_ai
classmethod
¶
from_pydantic_ai(
content: TContentType,
message: ModelMessage,
conversation_id: str | None = None,
name: str | None = None,
forwarded_from: list[str] | None = None,
) -> ChatMessage[TContentType]
Convert a Pydantic model to a ChatMessage.
Source code in src/llmling_agent/messaging/messages.py
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 | |
from_run_result
async
classmethod
¶
from_run_result(
result: AgentRunResult[OutputDataT],
*,
agent_name: str | None = None,
message_id: str | None = None,
conversation_id: str | None = None,
response_time: float
) -> ChatMessage[OutputDataT]
Create a ChatMessage from a PydanticAI run result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
AgentRunResult[OutputDataT]
|
The PydanticAI run result |
required |
agent_name
|
str | None
|
Name of the agent that generated this response |
None
|
message_id
|
str | None
|
Unique message identifier |
None
|
conversation_id
|
str | None
|
Conversation identifier |
None
|
response_time
|
float
|
Total time taken for the response |
required |
Returns:
| Type | Description |
|---|---|
ChatMessage[OutputDataT]
|
A ChatMessage with all fields populated from the result |
Source code in src/llmling_agent/messaging/messages.py
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 | |
get_tool_calls
¶
get_tool_calls(
tools: dict[str, Any] | None = None, agent_name: str | None = None
) -> list[ToolCallInfo]
Extract tool call information from all messages lazily.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tools
|
dict[str, Any] | None
|
Original Tool set to enrich ToolCallInfos with additional info |
None
|
agent_name
|
str | None
|
Name of the caller |
None
|
Source code in src/llmling_agent/messaging/messages.py
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 | |
to_pydantic_ai
¶
to_pydantic_ai() -> Sequence[ModelMessage]
Convert this message to a Pydantic model.
Source code in src/llmling_agent/messaging/messages.py
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 | |
to_request
¶
to_request() -> Self
Convert this message to a request message.
If the message is already a request (user role), this is a no-op. If it's a response (assistant role), converts response parts to user content.
Returns:
| Type | Description |
|---|---|
Self
|
New ChatMessage with role='user' and converted parts |
Source code in src/llmling_agent/messaging/messages.py
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 | |
user_prompt
classmethod
¶
user_prompt(
message: TPromptContent, conversation_id: str | None = None, instructions: str | None = None
) -> ChatMessage[TPromptContent]
Create a user prompt message.
Source code in src/llmling_agent/messaging/messages.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
ImageBase64Content
¶
Bases: BaseImageContent
Image from base64 data.
Source code in src/llmling_agent/models/content.py
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 | |
mime_type
class-attribute
instance-attribute
¶
mime_type: str = 'image/jpeg'
MIME type of the image.
type
class-attribute
instance-attribute
¶
type: Literal['image_base64'] = Field('image_base64', init=False)
Base64-encoded image.
from_bytes
classmethod
¶
from_bytes(
data: bytes, *, detail: DetailLevel | None = None, description: str | None = None
) -> ImageBase64Content
Create image content from raw bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
Raw image bytes |
required |
detail
|
DetailLevel | None
|
Optional detail level for processing |
None
|
description
|
str | None
|
Optional description of the image |
None
|
Source code in src/llmling_agent/models/content.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
from_pil_image
classmethod
¶
from_pil_image(image: Image) -> ImageBase64Content
Create content from PIL Image.
Source code in src/llmling_agent/models/content.py
129 130 131 132 133 134 | |
ImageURLContent
¶
Bases: BaseImageContent
Image from URL.
Source code in src/llmling_agent/models/content.py
82 83 84 85 86 87 88 89 90 91 92 | |
MessageNode
¶
Bases: ABC
Base class for all message processing nodes.
Source code in src/llmling_agent/messaging/messagenode.py
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 | |
connection_stats
property
¶
connection_stats: AggregatedTalkStats
Get stats for all active connections of this node.
message_received
class-attribute
instance-attribute
¶
message_received = Signal(ChatMessage)
Signal emitted when node receives a message.
message_sent
class-attribute
instance-attribute
¶
message_sent = Signal(ChatMessage)
Signal emitted when node creates a message.
__aenter__
async
¶
__aenter__() -> Self
Initialize base message node.
Source code in src/llmling_agent/messaging/messagenode.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
__aexit__
async
¶
__aexit__(
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None
Clean up base resources.
Source code in src/llmling_agent/messaging/messagenode.py
99 100 101 102 103 104 105 106 107 108 | |
__init__
¶
__init__(
name: str | None = None,
description: str | None = None,
input_provider: InputProvider | None = None,
mcp_servers: Sequence[str | MCPServerConfig] | None = None,
agent_pool: AgentPool[Any] | None = None,
enable_logging: bool = True,
) -> None
Initialize message node.
Source code in src/llmling_agent/messaging/messagenode.py
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 | |
__rshift__
¶
__rshift__(other: MessageNode[Any, Any] | ProcessorCallback[Any]) -> Talk[TResult]
__rshift__(
other: (
MessageNode[Any, Any]
| ProcessorCallback[Any]
| Sequence[MessageNode[Any, Any] | ProcessorCallback[Any]]
),
) -> Talk[Any] | TeamTalk[Any]
Connect agent to another agent or group.
Example
agent >> other_agent # Connect to single agent agent >> (agent2 & agent3) # Connect to group agent >> "other_agent" # Connect by name (needs pool)
Source code in src/llmling_agent/messaging/messagenode.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
connect_to
¶
connect_to(
target: MessageNode[Any, Any] | ProcessorCallback[Any],
*,
queued: Literal[True],
queue_strategy: Literal["concat"]
) -> Talk[str]
connect_to(
target: MessageNode[Any, Any] | ProcessorCallback[Any],
*,
connection_type: ConnectionType = "run",
name: str | None = None,
priority: int = 0,
delay: timedelta | None = None,
queued: bool = False,
queue_strategy: QueueStrategy = "latest",
transform: AnyTransformFn[Any] | None = None,
filter_condition: AsyncFilterFn | None = None,
stop_condition: AsyncFilterFn | None = None,
exit_condition: AsyncFilterFn | None = None
) -> Talk[TResult]
connect_to(
target: Sequence[MessageNode[Any, Any] | ProcessorCallback[Any]],
*,
queued: Literal[True],
queue_strategy: Literal["concat"]
) -> TeamTalk[str]
connect_to(
target: Sequence[MessageNode[Any, TResult] | ProcessorCallback[TResult]],
*,
connection_type: ConnectionType = "run",
name: str | None = None,
priority: int = 0,
delay: timedelta | None = None,
queued: bool = False,
queue_strategy: QueueStrategy = "latest",
transform: AnyTransformFn[Any] | None = None,
filter_condition: AsyncFilterFn | None = None,
stop_condition: AsyncFilterFn | None = None,
exit_condition: AsyncFilterFn | None = None
) -> TeamTalk[TResult]
connect_to(
target: Sequence[MessageNode[Any, Any] | ProcessorCallback[Any]],
*,
connection_type: ConnectionType = "run",
name: str | None = None,
priority: int = 0,
delay: timedelta | None = None,
queued: bool = False,
queue_strategy: QueueStrategy = "latest",
transform: AnyTransformFn[Any] | None = None,
filter_condition: AsyncFilterFn | None = None,
stop_condition: AsyncFilterFn | None = None,
exit_condition: AsyncFilterFn | None = None
) -> TeamTalk
connect_to(
target: (
MessageNode[Any, Any]
| ProcessorCallback[Any]
| Sequence[MessageNode[Any, Any] | ProcessorCallback[Any]]
),
*,
connection_type: ConnectionType = "run",
name: str | None = None,
priority: int = 0,
delay: timedelta | None = None,
queued: bool = False,
queue_strategy: QueueStrategy = "latest",
transform: AnyTransformFn[Any] | None = None,
filter_condition: AsyncFilterFn | None = None,
stop_condition: AsyncFilterFn | None = None,
exit_condition: AsyncFilterFn | None = None
) -> Talk[Any] | TeamTalk
Create connection(s) to target(s).
Source code in src/llmling_agent/messaging/messagenode.py
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 | |
disconnect_all
async
¶
disconnect_all() -> None
Disconnect from all nodes.
Source code in src/llmling_agent/messaging/messagenode.py
283 284 285 286 | |
get_message_history
async
¶
get_message_history(limit: int | None = None) -> list[ChatMessage[Any]]
Get message history from storage.
Source code in src/llmling_agent/messaging/messagenode.py
296 297 298 299 300 301 302 303 304 | |
get_stats
abstractmethod
async
¶
get_stats() -> MessageStats | AggregatedMessageStats
Get message statistics for this node.
Source code in src/llmling_agent/messaging/messagenode.py
311 312 313 | |
log_message
async
¶
log_message(message: ChatMessage[Any]) -> None
Handle message from chat signal.
Source code in src/llmling_agent/messaging/messagenode.py
306 307 308 309 | |
run
abstractmethod
async
¶
run(*prompts: Any, **kwargs: Any) -> ChatMessage[TResult]
Execute node with prompts. Implementation-specific run logic.
Source code in src/llmling_agent/messaging/messagenode.py
292 293 294 | |
run_iter
abstractmethod
¶
run_iter(*prompts: Any, **kwargs: Any) -> AsyncIterator[ChatMessage[Any]]
Yield messages during execution.
Source code in src/llmling_agent/messaging/messagenode.py
315 316 317 | |
stop_passing_results_to
¶
stop_passing_results_to(other: MessageNode[Any, Any]) -> None
Stop forwarding results to another node.
Source code in src/llmling_agent/messaging/messagenode.py
288 289 290 | |
PDFBase64Content
¶
Bases: BasePDFContent
PDF from base64 data.
Source code in src/llmling_agent/models/content.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
type
class-attribute
instance-attribute
¶
type: Literal['pdf_base64'] = Field('pdf_base64', init=False)
Base64-data based PDF.
from_bytes
classmethod
¶
from_bytes(
data: bytes, *, detail: DetailLevel | None = None, description: str | None = None
) -> Self
Create PDF content from raw bytes.
Source code in src/llmling_agent/models/content.py
194 195 196 197 198 199 200 201 202 203 204 | |
PDFURLContent
¶
Bases: BasePDFContent
PDF from URL.
Source code in src/llmling_agent/models/content.py
172 173 174 175 176 177 178 179 180 181 182 | |
Team
¶
Group of agents that can execute together.
Source code in src/llmling_agent/delegation/team.py
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 | |
__prompt__
¶
__prompt__() -> str
Format team info for prompts.
Source code in src/llmling_agent/delegation/team.py
118 119 120 121 122 | |
execute
async
¶
execute(*prompts: PromptCompatible | None, **kwargs: Any) -> TeamResponse
Run all agents in parallel with monitoring.
Source code in src/llmling_agent/delegation/team.py
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 | |
run
async
¶
run(
*prompts: PromptCompatible | None,
wait_for_connections: bool | None = None,
store_history: bool = False,
**kwargs: Any
) -> ChatMessage[list[Any]]
Run all agents in parallel and return combined message.
Source code in src/llmling_agent/delegation/team.py
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 | |
run_iter
async
¶
run_iter(*prompts: AnyPromptType, **kwargs: Any) -> AsyncIterator[ChatMessage[Any]]
Yield messages as they arrive from parallel execution.
Source code in src/llmling_agent/delegation/team.py
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 | |
run_job
async
¶
run_job(
job: Job[TDeps, TJobResult], *, store_history: bool = True, include_agent_tools: bool = True
) -> list[AgentResponse[TJobResult]]
Execute a job across all team members in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
Job[TDeps, TJobResult]
|
Job configuration to execute |
required |
store_history
|
bool
|
Whether to add job execution to conversation history |
True
|
include_agent_tools
|
bool
|
Whether to include agent's tools alongside job tools |
True
|
Returns:
| Type | Description |
|---|---|
list[AgentResponse[TJobResult]]
|
List of responses from all agents |
Raises:
| Type | Description |
|---|---|
JobError
|
If job execution fails for any agent |
ValueError
|
If job configuration is invalid |
Source code in src/llmling_agent/delegation/team.py
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 | |
run_stream
async
¶
run_stream(
*prompts: PromptCompatible, **kwargs: Any
) -> AsyncIterator[tuple[MessageNode[Any, Any], RichAgentStreamEvent[Any]]]
Stream responses from all team members in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompts
|
PromptCompatible
|
Input prompts to process in parallel |
()
|
kwargs
|
Any
|
Additional arguments passed to each agent |
{}
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[tuple[MessageNode[Any, Any], RichAgentStreamEvent[Any]]]
|
Tuples of (agent, event) where agent is the Agent instance |
AsyncIterator[tuple[MessageNode[Any, Any], RichAgentStreamEvent[Any]]]
|
and event is the streaming event from that agent. |
Source code in src/llmling_agent/delegation/team.py
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 | |
TeamRun
¶
Bases: BaseTeam[TDeps, TResult]
Handles team operations with monitoring.
Source code in src/llmling_agent/delegation/teamrun.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 | |
__prompt__
¶
__prompt__() -> str
Format team info for prompts.
Source code in src/llmling_agent/delegation/teamrun.py
127 128 129 130 131 | |
execute
async
¶
execute(*prompts: PromptCompatible | None, **kwargs: Any) -> TeamResponse[TResult]
Start execution with optional monitoring.
Source code in src/llmling_agent/delegation/teamrun.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
run
async
¶
run(
*prompts: PromptCompatible | None,
wait_for_connections: bool | None = None,
store_history: bool = False,
**kwargs: Any
) -> ChatMessage[TResult]
Run agents sequentially and return combined message.
Source code in src/llmling_agent/delegation/teamrun.py
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 | |
run_iter
async
¶
run_iter(*prompts: PromptCompatible, **kwargs: Any) -> AsyncIterator[ChatMessage[Any]]
Yield messages from the execution chain.
Source code in src/llmling_agent/delegation/teamrun.py
207 208 209 210 211 212 213 214 215 216 217 218 219 | |
run_stream
async
¶
run_stream(
*prompts: PromptCompatible, require_all: bool = True, **kwargs: Any
) -> AsyncIterator[tuple[MessageNode[Any, Any], RichAgentStreamEvent[Any]]]
Stream responses through the chain of team members.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompts
|
PromptCompatible
|
Input prompts to process through the chain |
()
|
require_all
|
bool
|
If True, fail if any agent fails. If False, continue with remaining agents. |
True
|
kwargs
|
Any
|
Additional arguments passed to each agent |
{}
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[tuple[MessageNode[Any, Any], RichAgentStreamEvent[Any]]]
|
Tuples of (agent, event) where agent is the Agent instance |
AsyncIterator[tuple[MessageNode[Any, Any], RichAgentStreamEvent[Any]]]
|
and event is the streaming event. |
Source code in src/llmling_agent/delegation/teamrun.py
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 | |
Tool
dataclass
¶
Information about a registered tool.
Source code in src/llmling_agent/tools/base.py
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 | |
agent_name
class-attribute
instance-attribute
¶
agent_name: str | None = None
The agent name as an identifier for agent-as-a-tool.
category
class-attribute
instance-attribute
¶
category: ToolKind | None = None
The category of the tool.
enabled
class-attribute
instance-attribute
¶
enabled: bool = True
Whether the tool is currently enabled
import_path
class-attribute
instance-attribute
¶
import_path: str | None = None
The import path for the tool.
metadata
class-attribute
instance-attribute
¶
Additional tool metadata
requires_confirmation
class-attribute
instance-attribute
¶
requires_confirmation: bool = False
Whether tool execution needs explicit confirmation
schema_override
class-attribute
instance-attribute
¶
schema_override: OpenAIFunctionDefinition | None = None
Schema override. If not set, the schema is inferred from the callable.
source
class-attribute
instance-attribute
¶
source: ToolSource = 'dynamic'
Where the tool came from.
execute
async
¶
Execute tool, handling both sync and async cases.
Source code in src/llmling_agent/tools/base.py
159 160 161 162 | |
format_info
¶
Format complete tool information.
Source code in src/llmling_agent/tools/base.py
146 147 148 149 150 151 152 153 154 155 156 157 | |
from_autogen_tool
classmethod
¶
from_autogen_tool(
tool: Any,
*,
name_override: str | None = None,
description_override: str | None = None,
schema_override: OpenAIFunctionDefinition | None = None,
**kwargs: Any
) -> Tool[Any]
Create a tool from a AutoGen tool.
Source code in src/llmling_agent/tools/base.py
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 | |
from_code
classmethod
¶
Create a tool from a code string.
Source code in src/llmling_agent/tools/base.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
from_crewai_tool
classmethod
¶
from_crewai_tool(
tool: Any,
*,
name_override: str | None = None,
description_override: str | None = None,
schema_override: OpenAIFunctionDefinition | None = None,
**kwargs: Any
) -> Tool[Any]
Allows importing crewai tools.
Source code in src/llmling_agent/tools/base.py
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 | |
from_langchain_tool
classmethod
¶
from_langchain_tool(
tool: Any,
*,
name_override: str | None = None,
description_override: str | None = None,
schema_override: OpenAIFunctionDefinition | None = None,
**kwargs: Any
) -> Tool[Any]
Create a tool from a LangChain tool.
Source code in src/llmling_agent/tools/base.py
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 | |
matches_filter
¶
matches_filter(state: ToolState) -> bool
Check if tool matches state filter.
Source code in src/llmling_agent/tools/base.py
119 120 121 122 123 124 125 126 127 | |
to_mcp_tool
¶
to_mcp_tool() -> Tool
Convert internal Tool to MCP Tool.
Source code in src/llmling_agent/tools/base.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
to_pydantic_ai
¶
to_pydantic_ai() -> Tool
Convert tool to Pydantic AI tool.
Source code in src/llmling_agent/tools/base.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
ToolCallInfo
¶
Bases: Schema
Information about an executed tool call.
Source code in src/llmling_agent/tools/tool_call_info.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 | |
agent_tool_name
class-attribute
instance-attribute
¶
agent_tool_name: str | None = None
If this tool is agent-based, the name of that agent.
error
class-attribute
instance-attribute
¶
error: str | None = None
Error message if the tool call failed.
message_id
class-attribute
instance-attribute
¶
message_id: str | None = None
ID of the message that triggered this tool call.
timestamp
class-attribute
instance-attribute
¶
When the tool was called.
timing
class-attribute
instance-attribute
¶
timing: float | None = None
Time taken for this specific tool call in seconds.
tool_call_id
class-attribute
instance-attribute
¶
ID provided by the model (e.g. OpenAI function call ID).
format
¶
format(
style: FormatStyle = "simple",
*,
template: str | None = None,
variables: dict[str, Any] | None = None,
show_timing: bool = True,
show_ids: bool = False
) -> str
Format tool call information with configurable style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
FormatStyle
|
Predefined style to use: - simple: Compact single-line format - detailed: Multi-line with all details - markdown: Formatted markdown with syntax highlighting |
'simple'
|
template
|
str | None
|
Optional custom template (required if style="custom") |
None
|
variables
|
dict[str, Any] | None
|
Additional variables for template rendering |
None
|
show_timing
|
bool
|
Whether to include execution timing |
True
|
show_ids
|
bool
|
Whether to include tool_call_id and message_id |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted tool call information |
Raises:
| Type | Description |
|---|---|
ValueError
|
If style is invalid or custom template is missing |
Source code in src/llmling_agent/tools/tool_call_info.py
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 | |
VideoURLContent
¶
Bases: VideoContent
Video from URL.
Source code in src/llmling_agent/models/content.py
288 289 290 291 292 293 294 295 | |