Agent Protocol • AI Agent SDK
AgentProtocol: Minimal Protocol for agent implementations.
AgentProtocol
Defined in the protocols module.
AI Agent
Minimal Protocol for agent implementations.
This defines the essential interface that any agent must provide. It enables proper mocking and testing without real LLM dependencies.
Methods
name()
Agent’s name identifier.
chat()Synchronous chat with the agent.
achat()Asynchronous chat with the agent.
Usage
# Create a mock agent for testing
class MockAgent:
@property
def name(self) -> str:
return "TestAgent"
def chat(self, prompt: str, **kwargs) -> str:
return "Mock response"
async def achat(self, prompt: str, **kwargs) -> str:
return "Async mock response"
# Use in tests
agent: AgentProtocol = MockAgent()
result = agent.chat("Hello")Source
View on GitHubpraisonaiagents/agent/protocols.py at line 35