Skip to main content
Glama

start_interactive_agent

Initiate an interactive ACP agent session, enabling user input integration and communication via the ACP-MCP Server for AI agent workflows with customizable timeouts.

Instructions

Start an interactive ACP agent that may require user input

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_nameYes
initial_inputYes
session_idNo
timeout_minutesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • FastMCP @tool decorator and handler function for 'start_interactive_agent' that invokes the InteractiveManager method and serializes the result to JSON.
    @mcp.tool()
    async def start_interactive_agent(
        agent_name: str,
        initial_input: str,
        session_id: str = None,
        timeout_minutes: int = 5
    ) -> str:
        """Start an interactive ACP agent that may require user input"""
        
        try:
            result = await manager.start_interactive_agent(
                agent_name=agent_name,
                initial_input=initial_input,
                session_id=session_id,
                timeout_seconds=timeout_minutes * 60
            )
            
            return json.dumps(result, indent=2)
            
        except Exception as e:
            return f"Error: {e}"
  • Core logic for starting an interactive agent in the InteractiveManager class, handling execution, pending interactions, and output processing.
    async def start_interactive_agent(
        self,
        agent_name: str,
        initial_input: str,
        session_id: Optional[str] = None,
        timeout_seconds: int = 300
    ) -> Dict[str, Any]:
        """Start an interactive agent that may require user input"""
        
        try:
            # Start the agent execution
            run = await self.orchestrator.execute_agent_sync(
                agent_name=agent_name,
                input_text=initial_input,
                session_id=session_id
            )
            
            # Check if agent is waiting for input
            if hasattr(run, 'await_request') and run.await_request:
                # Agent is waiting for input
                pending = PendingInteraction(
                    run_id=run.run_id,
                    agent_name=agent_name,
                    session_id=session_id,
                    await_message=run.await_request.get('message', 'Agent is waiting for input'),
                    timestamp=asyncio.get_event_loop().time(),
                    timeout_seconds=timeout_seconds
                )
                
                self.pending_interactions[run.run_id] = pending
                
                return {
                    "status": "awaiting_input",
                    "run_id": run.run_id,
                    "message": pending.await_message,
                    "timeout_seconds": timeout_seconds
                }
            
            else:
                # Agent completed normally
                output = ""
                if run.output:
                    # Handle ACP output format - run.output is already a list of messages
                    output_text = ""
                    for message in run.output:
                        if isinstance(message, dict) and "parts" in message:
                            for part in message["parts"]:
                                if isinstance(part, dict) and "content" in part:
                                    output_text += part["content"] + "\n"
                    output = output_text.strip() if output_text else "No text content"
                
                return {
                    "status": "completed",
                    "run_id": run.run_id,
                    "output": output,
                    "error": run.error
                }
                
        except Exception as e:
            return {
                "status": "error",
                "error": str(e)
            }
  • Invocation of register_interactive_tools which defines and registers the MCP tool 'start_interactive_agent' along with related interactive tools.
    register_interactive_tools(self.mcp, self.interactive_manager)
  • Registration function that defines and registers the interactive tools including 'start_interactive_agent' using @mcp.tool() decorators.
    def register_interactive_tools(mcp: FastMCP, manager: InteractiveManager):
        
        @mcp.tool()
        async def start_interactive_agent(
            agent_name: str,
            initial_input: str,
            session_id: str = None,
            timeout_minutes: int = 5
        ) -> str:
            """Start an interactive ACP agent that may require user input"""
            
            try:
                result = await manager.start_interactive_agent(
                    agent_name=agent_name,
                    initial_input=initial_input,
                    session_id=session_id,
                    timeout_seconds=timeout_minutes * 60
                )
                
                return json.dumps(result, indent=2)
                
            except Exception as e:
                return f"Error: {e}"
        
        @mcp.tool()
        async def provide_user_input(
            run_id: str,
            user_input: str
        ) -> str:
            """Provide user input to resume a waiting interactive agent"""
            
            try:
                result = await manager.resume_interactive_agent(run_id, user_input)
                
                return json.dumps(result, indent=2)
                
            except Exception as e:
                return f"Error: {e}"
        
        @mcp.tool()
        async def list_pending_interactions() -> str:
            """List all pending interactive agents waiting for input"""
            
            try:
                interactions = await manager.get_pending_interactions()
                
                return json.dumps(interactions, indent=2)
                
            except Exception as e:
                return f"Error: {e}"
        
        @mcp.tool()
        async def cancel_interaction(run_id: str) -> str:
            """Cancel a pending interactive agent"""
            
            try:
                success = await manager.cancel_interaction(run_id)
                
                if success:
                    return f"Successfully cancelled interaction: {run_id}"
                else:
                    return f"No pending interaction found with ID: {run_id}"
                    
            except Exception as e:
                return f"Error: {e}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the agent 'may require user input', hinting at interactive behavior, but fails to detail critical aspects like authentication needs, rate limits, error handling, or what 'starting' entails operationally. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that is front-loaded with the core action. It avoids unnecessary words, making it appropriately concise, though it could benefit from more detail given the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (4 parameters, interactive nature) and the presence of an output schema, the description is incomplete. It lacks details on parameters, behavioral traits, and usage context, failing to provide enough information for effective tool selection and invocation, even with the output schema covering return values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter details. The description adds no meaning beyond the schema, as it does not explain any parameters (e.g., 'agent_name', 'initial_input', 'session_id', 'timeout_minutes'), their purposes, or how they affect the tool's operation. This fails to compensate for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Start[s] an interactive ACP agent that may require user input', which provides a clear verb ('Start') and resource ('interactive ACP agent'). However, it lacks specificity about what distinguishes this from sibling tools like 'run_acp_agent' or 'discover_acp_agents', making the purpose somewhat vague in context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool versus alternatives. It does not mention prerequisites, exclusions, or comparisons to sibling tools such as 'run_acp_agent' or 'provide_user_input', leaving the agent with no explicit usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GongRzhe/ACP-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server