Skip to content

Create Subagent natively using AgentDefinition vs creating an agent and wrapping it as a tool for the lead agent #225

@kargarisaac

Description

@kargarisaac

Hello,

I have been trying to build a multi agent system with subagents specialized in processing some files like csv and have been trying to use AgentDefinition, but I face some permission issues and I don't see how can I provide permissions for the subagent in the doc:

@dataclass
class AgentDefinition:
    description: str
    prompt: str
    tools: list[str] | None = None
    model: Literal["sonnet", "opus", "haiku", "inherit"] | None = None

And it was failing allot with no permission error types. At the end, I created agents and wrapped them in @tool and gave them to the lead agent. But I think in this way the conversation history between the lead and the subagent is gone each time the lead calls the subagent as it creates a new session, right? any solution or thought on this? am I doing sth wrong or is this the sdk limitation? what is the write way to do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions