Implementation:BerriAI Litellm Agent Types
Appearance
| Attribute | Value |
|---|---|
| Sources | litellm/types/agents.py |
| Domains | Agents, A2A Protocol, Agent Cards, Security Schemes |
| Last Updated | 2026-02-15 16:00 GMT |
Overview
Type definitions for the LiteLLM agent subsystem, implementing the Agent-to-Agent (A2A) protocol with agent cards, capabilities, security schemes, and CRUD request/response models.
Description
This module provides the full type hierarchy for LiteLLM's agent management system. It follows the A2A protocol specification for agent interoperability. Key types include:
- AgentCard -- The self-describing manifest for an agent, containing identity, capabilities, skills, communication methods, and security requirements.
- AgentCapabilities -- Declares what an agent supports (streaming, push notifications, state transition history, extensions).
- AgentSkill -- Represents a distinct capability or function an agent can perform, with input/output modes and tags.
- Security scheme types -- A family of TypedDicts (APIKeySecurityScheme, HTTPAuthSecurityScheme, OAuth2SecurityScheme, OpenIdConnectSecurityScheme, MutualTLSSecurityScheme) implementing OpenAPI-style security definitions.
- AgentConfig -- The configuration format for defining agents in proxy YAML config.
- CRUD models -- AgentResponse, ListAgentsResponse, MakeAgentsPublicRequest, AgentMakePublicResponse, PatchAgentRequest for the management API.
- LiteLLMSendMessageResponse -- A wrapper around the A2A SDK's SendMessageResponse that adds LiteLLM's hidden params for cost tracking and logging integration.
Usage
Import from this module when:
- Defining agent configurations in the LiteLLM proxy.
- Building or consuming the agent management REST API.
- Working with the A2A protocol's agent card specification.
- Wrapping A2A responses with LiteLLM cost tracking metadata.
Code Reference
Source Location
litellm/types/agents.py (261 lines)
Key Types
| Type Name | Kind | Description |
|---|---|---|
AgentProvider |
TypedDict | Agent service provider info (organization, url) |
AgentExtension |
TypedDict | A protocol extension declaration (uri, description, required, params) |
AgentCapabilities |
TypedDict | Agent capabilities (streaming, pushNotifications, stateTransitionHistory, extensions) |
SecuritySchemeBase |
TypedDict | Base security scheme with optional description |
APIKeySecurityScheme |
TypedDict | API key auth scheme (in query/header/cookie) |
HTTPAuthSecurityScheme |
TypedDict | HTTP auth scheme (bearer, basic, etc.) |
MutualTLSSecurityScheme |
TypedDict | mTLS authentication scheme |
OAuthFlows |
TypedDict | OAuth 2.0 flow configurations |
OAuth2SecurityScheme |
TypedDict | OAuth 2.0 security scheme with flows |
OpenIdConnectSecurityScheme |
TypedDict | OpenID Connect security scheme |
SecurityScheme |
Union type | Union of all security scheme types |
AgentSkill |
TypedDict | A skill the agent can perform (id, name, description, tags, examples) |
AgentInterface |
TypedDict | Agent URL and transport protocol declaration |
AgentCardSignature |
TypedDict | JWS signature of an AgentCard |
AgentCard |
TypedDict | The full self-describing agent manifest |
AugmentedAgentCard |
TypedDict | AgentCard extended with an is_public flag |
AgentConfig |
TypedDict | Proxy config entry: agent_name, agent_card_params, litellm_params |
PatchAgentRequest |
TypedDict | Partial update request for an agent |
AgentResponse |
BaseModel | API response for a single agent |
ListAgentsResponse |
BaseModel | API response listing multiple agents |
AgentMakePublicResponse |
BaseModel | Response after making agents public |
MakeAgentsPublicRequest |
BaseModel | Request to make agents public by IDs |
LiteLLMSendMessageResponse |
LiteLLMPydanticObjectBase | A2A SendMessageResponse wrapper with _hidden_params for cost tracking |
Signature: LiteLLMSendMessageResponse.from_a2a_response
@classmethod
def from_a2a_response(
cls, response: "SendMessageResponse"
) -> "LiteLLMSendMessageResponse"
Signature: LiteLLMSendMessageResponse.from_dict
@classmethod
def from_dict(cls, response_dict: Dict[str, Any]) -> "LiteLLMSendMessageResponse"
Import
from litellm.types.agents import (
AgentCard,
AgentCapabilities,
AgentSkill,
AgentConfig,
AgentResponse,
ListAgentsResponse,
LiteLLMSendMessageResponse,
SecurityScheme,
PatchAgentRequest,
)
I/O Contract
AgentCard (Required Fields)
| Field | Type | Description |
|---|---|---|
protocolVersion |
str |
A2A protocol version |
name |
str |
Agent name |
description |
str |
Agent description |
url |
str |
Agent endpoint URL |
version |
str |
Agent version |
capabilities |
AgentCapabilities |
Supported capabilities |
defaultInputModes |
List[str] |
Default input MIME types |
defaultOutputModes |
List[str] |
Default output MIME types |
skills |
List[AgentSkill] |
List of agent skills |
AgentResponse (Output)
| Field | Type | Description |
|---|---|---|
agent_id |
str |
Unique agent identifier |
agent_name |
str |
Agent name |
litellm_params |
Optional[Dict[str, Any]] |
LiteLLM configuration parameters |
agent_card_params |
Dict[str, Any] |
Full agent card data |
created_at |
Optional[datetime] |
Creation timestamp |
updated_at |
Optional[datetime] |
Last update timestamp |
created_by |
Optional[str] |
Creator identifier |
updated_by |
Optional[str] |
Last updater identifier |
LiteLLMSendMessageResponse (Output)
| Field | Type | Description |
|---|---|---|
id |
str |
JSON-RPC response ID |
jsonrpc |
str |
JSON-RPC version (default "2.0") |
result |
Optional[Dict[str, Any]] |
A2A response result |
error |
Optional[Dict[str, Any]] |
A2A error, if any |
usage |
Optional[Dict[str, Any]] |
Token/cost usage tracking |
_hidden_params |
dict |
Private LiteLLM logging/cost metadata |
Usage Examples
Defining an agent in proxy config
from litellm.types.agents import AgentConfig, AgentCard, AgentSkill, AgentCapabilities
config: AgentConfig = {
"agent_name": "my-summarizer",
"agent_card_params": {
"protocolVersion": "1.0",
"name": "Summarizer Agent",
"description": "Summarizes text input",
"url": "https://agent.example.com/summarize",
"version": "1.0.0",
"capabilities": {"streaming": True},
"defaultInputModes": ["text/plain"],
"defaultOutputModes": ["text/plain"],
"skills": [
{
"id": "summarize",
"name": "Summarize",
"description": "Summarizes input text",
"tags": ["nlp", "summarization"],
}
],
},
"litellm_params": {"model": "gpt-4"},
}
Wrapping an A2A response
from litellm.types.agents import LiteLLMSendMessageResponse
# From a dict
response = LiteLLMSendMessageResponse.from_dict({
"id": "req-123",
"jsonrpc": "2.0",
"result": {"taskId": "task-456", "status": "completed"},
})
response._hidden_params["litellm_call_id"] = "call-789"
Listing agents via API response
from litellm.types.agents import AgentResponse, ListAgentsResponse
agents_response = ListAgentsResponse(
agents=[
AgentResponse(
agent_id="agent-001",
agent_name="my-summarizer",
agent_card_params={"name": "Summarizer Agent"},
)
]
)
Related Pages
- MCP Types -- Model Context Protocol types for tool-calling flows that may interact with agents.
- Guardrail Types -- Guardrail types that can be applied to agent-mediated calls.
- Proxy Server -- The proxy server that hosts agent management endpoints.
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment