task_tool
langroid/agent/tools/task_tool.py
A tool that allows agents to delegate a task to a sub-agent with
specific tools enabled.
TaskTool
¶
Bases: ToolMessage
Tool that spawns a sub-agent with specified tools to handle a task.
The sub-agent can be given a custom name for identification in logs. If no name is provided, a random unique name starting with 'agent' will be generated.
handle(agent)
¶
Handle the TaskTool by creating a sub-agent with specified tools and running the task non-interactively.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent
|
ChatAgent
|
The parent ChatAgent that is handling this tool |
required |
Source code in langroid/agent/tools/task_tool.py
handle_async(agent)
async
¶
Async method to handle the TaskTool by creating a sub-agent with specified tools and running the task non-interactively.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent
|
ChatAgent
|
The parent ChatAgent that is handling this tool |
required |