Iagent

Classes

class arshai.core.interfaces.iagent.IAgent(*args, **kwargs)[source]

Bases: Protocol

Agent interface.

All agents must implement this protocol. The interface gives maximum flexibility to developers for response format.

async process(input)[source]

Process the input and return a response.

This is the only required method for agents. The return type is Any to give developers full authority over: - Response format (streaming, structured, simple string, etc.) - Data structure (custom DTOs, tuples, dicts, etc.) - Streaming vs non-streaming responses

Agents can internally use tools, memory, or any other capabilities as needed.

Parameters:

input (IAgentInput) – The input containing message and optional metadata

Returns:

Developer-defined response format

Return type:

Any

__init__(*args, **kwargs)
class arshai.core.interfaces.iagent.IAgentInput(**data)[source]

Bases: IDTO

Input for agents.

message

The user’s message to process

metadata

Optional metadata for agent-specific context (conversation_id, stream, etc.)

message: str
metadata: Optional[Dict[str, Any]]
model_config: ClassVar[ConfigDict] = {'allow_mutation': False, 'arbitrary_types_allowed': True, 'smart_union': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].