Extracts the input_schema from an agent. For LlmAgent, returns its input_schema directly. For agents with sub_agents, recursively searches the first sub-agent for an input_schema. Args: agent: The agent to extract input_schema from. Returns: The input_schema if found, None other
(agent: BaseAgent)
| 55 | |
| 56 | |
| 57 | def _get_input_schema(agent: BaseAgent) -> Optional[type[BaseModel]]: |
| 58 | """Extracts the input_schema from an agent. |
| 59 | |
| 60 | For LlmAgent, returns its input_schema directly. |
| 61 | For agents with sub_agents, recursively searches the first sub-agent for an |
| 62 | input_schema. |
| 63 | |
| 64 | Args: |
| 65 | agent: The agent to extract input_schema from. |
| 66 | |
| 67 | Returns: |
| 68 | The input_schema if found, None otherwise. |
| 69 | """ |
| 70 | from ..agents.llm_agent import LlmAgent |
| 71 | |
| 72 | if isinstance(agent, LlmAgent): |
| 73 | return agent.input_schema |
| 74 | |
| 75 | # For composite agents, check the first sub-agent |
| 76 | if agent.sub_agents: |
| 77 | return _get_input_schema(agent.sub_agents[0]) |
| 78 | |
| 79 | return None |
| 80 | |
| 81 | |
| 82 | def _get_output_schema(agent: BaseAgent) -> Optional[SchemaType]: |
no outgoing calls
no test coverage detected