agentconnect.agents.human_agent module

Human agent implementation for the AgentConnect framework.

This module provides a human agent that can interact with AI agents through a command-line interface.

class HumanAgent(agent_id, name, identity, organization_id=None, response_callbacks=None)

Bases: BaseAgent

Human agent implementation for interactive communication with AI agents.

This agent handles:

  • Real-time text input/output

  • Message verification and security

  • Graceful conversation management

  • Error handling and recovery

Parameters:
async start_interaction(target_agent)

Start an interactive session with an AI agent

Return type:

None

Parameters:

target_agent (BaseAgent)

async process_message(message)

Process incoming messages from other agents

Return type:

Optional[Message]

Parameters:

message (Message)

async send_message(receiver_id, content, message_type=MessageType.TEXT, metadata=None)

Override send_message to track human responses and notify callbacks

Return type:

Message

Parameters:
add_response_callback(callback)

Add a callback to be notified when the human sends a response

Return type:

None

Parameters:

callback (Callable)

remove_response_callback(callback)

Remove a previously registered callback

Return type:

None

Parameters:

callback (Callable)