Skip to content

Python: [AG-UI]Tool execution repeats after Human-in-the-loop approval #4075

@TsukasaIshimura

Description

@TsukasaIshimura

I’m building an app using MAF AG-UI and CopilotKit.
After I approve a tool execution in a human-in-the-loop flow, the tool gets executed every time I send a chat message.

Expected:
If the user asks a question unrelated to the tool, the tool should not be executed.
Actual:
The tool is executed every time I send a chat message.

Video(Left:CopilotKit screen, Right:MCP server logs)

maf_video.mp4

Source code

local_mcp = MCPStreamableHTTPTool(
    name="local-mcp",
    url="http://localhost:8002/mcp",
    approval_mode="always_require",
)

base_agent = Agent(
    name="MyAgent",
    instructions="You are a helpful AI Agent.",
    client=chat_client,
    tools=[
        local_mcp,
    ],
)

add_agent_framework_fastapi_endpoint(
    app=app,
    agent=AgentFrameworkAgent(
        agent=base_agent,
        name="MyAgent",
        description="Helpful AI Agent",
        require_confirmation=True,
    ),
    path="/api/v1/agents/my-agent",
)

Version information
Python 3.13.10
agent-framework-ag-ui 1.0.0b260212
agent-framework-core 1.0.0b260212

Thank you in advance.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions