Skip to content

Agent not effective #994

@hoyinli26

Description

@hoyinli26

I referred to the example:

`

options = ClaudeAgentOptions(
    agents={
        "code-reviewer": AgentDefinition(
            description="Reviews code for best practices and potential issues",
            prompt="You are a code reviewer. Analyze code for bugs, performance issues, "
            "security vulnerabilities, and adherence to best practices. "
            "Provide constructive feedback.",
            tools=["Read", "Grep"],
            model="sonnet",
        ),
    },
)

async for message in query(
    prompt="Use the code-reviewer agent to review the code in src/claude_agent_sdk/types.py",
    options=options,
):
    if isinstance(message, AssistantMessage):
        for block in message.content:
            if isinstance(block, TextBlock):
                print(f"Claude: {block.text}")
    elif isinstance(message, ResultMessage) and message.total_cost_usd and message.total_cost_usd > 0:
        print(f"\nCost: ${message.total_cost_usd:.4f}")
print()

`

Hello, when using multi-agent, I found that the returned content always uses Opus instead of Sonnet. Are there any relevant logs or other configurations I can check to troubleshoot the cause?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions