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.

Diagram

Input Data

Agent: AgentProtocol

Output Result

Methods

Usage

python
# 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 GitHub

praisonaiagents/agent/protocols.py at line 35


Related Documentation