docstring args for ToolCallingAgent, CodeAgent and ManagedAgent (#335)

* docstring args for ToolCallingAgent, CodeAgent and ManagedAgent

* Fix ToolCallingAgent and CodeAgent docstring

* Minor fix

---------

Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>
This commit is contained in:
Touseef Ahmad 2025-01-24 19:03:49 +05:00 committed by GitHub
parent 73621c9cd1
commit b5b55a5686
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 38 additions and 3 deletions

View File

@ -670,6 +670,14 @@ Now begin!""",
class ToolCallingAgent(MultiStepAgent): class ToolCallingAgent(MultiStepAgent):
""" """
This agent uses JSON-like tool calls, using method `model.get_tool_call` to leverage the LLM engine's tool calling capabilities. This agent uses JSON-like tool calls, using method `model.get_tool_call` to leverage the LLM engine's tool calling capabilities.
Args:
tools (`list[Tool]`): [`Tool`]s that the agent can use.
model (`Callable[[list[dict[str, str]]], ChatMessage]`): Model that will generate the agent's actions.
system_prompt (`str`, *optional*): System prompt that will be used to generate the agent's actions.
planning_interval (`int`, *optional*): Interval at which the agent will run a planning step.
**kwargs: Additional keyword arguments.
""" """
def __init__( def __init__(
@ -776,6 +784,18 @@ class ToolCallingAgent(MultiStepAgent):
class CodeAgent(MultiStepAgent): class CodeAgent(MultiStepAgent):
""" """
In this agent, the tool calls will be formulated by the LLM in code format, then parsed and executed. In this agent, the tool calls will be formulated by the LLM in code format, then parsed and executed.
Args:
tools (`list[Tool]`): [`Tool`]s that the agent can use.
model (`Callable[[list[dict[str, str]]], ChatMessage]`): Model that will generate the agent's actions.
system_prompt (`str`, *optional*): System prompt that will be used to generate the agent's actions.
grammar (`dict[str, str]`, *optional*): Grammar used to parse the LLM output.
additional_authorized_imports (`list[str]`, *optional*): Additional authorized imports for the agent.
planning_interval (`int`, *optional*): Interval at which the agent will run a planning step.
use_e2b_executor (`bool`, default `False`): Whether to use the E2B executor for remote code execution.
max_print_outputs_length (`int`, *optional*): Maximum length of the print outputs.
**kwargs: Additional keyword arguments.
""" """
def __init__( def __init__(
@ -834,9 +854,11 @@ class CodeAgent(MultiStepAgent):
super().initialize_system_prompt() super().initialize_system_prompt()
self.system_prompt = self.system_prompt.replace( self.system_prompt = self.system_prompt.replace(
"{{authorized_imports}}", "{{authorized_imports}}",
"You can import from any package you want." (
if "*" in self.authorized_imports "You can import from any package you want."
else str(self.authorized_imports), if "*" in self.authorized_imports
else str(self.authorized_imports)
),
) )
return self.system_prompt return self.system_prompt
@ -949,6 +971,19 @@ class CodeAgent(MultiStepAgent):
class ManagedAgent: class ManagedAgent:
"""
ManagedAgent class that manages an agent and provides additional prompting and run summaries.
Args:
agent (`object`): The agent to be managed.
name (`str`): The name of the managed agent.
description (`str`): A description of the managed agent.
additional_prompting (`Optional[str]`, *optional*): Additional prompting for the managed agent. Defaults to None.
provide_run_summary (`bool`, *optional*): Whether to provide a run summary after the agent completes its task. Defaults to False.
managed_agent_prompt (`Optional[str]`, *optional*): Custom prompt for the managed agent. Defaults to None.
"""
def __init__( def __init__(
self, self,
agent, agent,