AgentX
Menu

API Models

Data models and schemas used across the API. All models use Pydantic unless noted as @dataclass.


Provider Models

Defined in providers/base.py.

Message

FieldTypeRequiredDescription
roleMessageRoleyes"system", "user", "assistant", "tool"
contentstringyesMessage text
namestringnoTool name (for tool messages)
tool_call_idstringnoID linking to a tool call
tool_callslist[dict]noTool calls requested by assistant

ToolCall

FieldTypeDescription
idstringUnique tool call ID
namestringTool function name
argumentsdictParsed arguments

StreamChunk

FieldTypeDescription
contentstringToken text (may be empty)
finish_reasonstringnull, "stop", "tool_calls"
tool_callslist[ToolCall]Tool calls collected during stream

CompletionResult

FieldTypeDescription
contentstringGenerated text
finish_reasonstring"stop", "length", "tool_calls"
tool_callslist[ToolCall]Tool calls (if function calling)
usagedict{"prompt_tokens": int, "completion_tokens": int, "total_tokens": int}
modelstringModel ID used
raw_responsedictFull provider response (debug)

ModelCapabilities (@dataclass)

FieldTypeDefaultDescription
supports_toolsboolfalseFunction calling support
supports_visionboolfalseImage input support
supports_streamingbooltrueStreaming support
supports_json_modeboolfalseJSON mode support
context_windowint4096Max input tokens
max_output_tokensintnullMax output tokens
cost_per_1k_inputfloatnullInput cost in USD
cost_per_1k_outputfloatnullOutput cost in USD

Agent Models

Defined in agent/core.py.

AgentResult

FieldTypeDescription
task_idstringShort UUID for the task
statusAgentStatus"idle", "planning", "reasoning", "executing", "complete", "failed", "cancelled"
answerstringFinal response text
thinkingstringExtracted <think> tag content
has_thinkingboolWhether thinking was extracted
plan_stepsintNumber of plan steps executed
reasoning_stepsintNumber of reasoning steps
tools_usedlist[string]Names of tools invoked
models_usedlist[string]Model IDs used
total_tokensintTotal token count
total_time_msfloatElapsed time in milliseconds
tracelist[dict]Debug trace (optional)

AgentConfig (@dataclass)

FieldTypeDefaultDescription
namestring"agentx"Agent name
user_idstringnullUser identifier
default_modelstring"llama3.2"Default model
reasoning_modelstringnullOverride for reasoning
drafting_modelstringnullOverride for drafting
max_iterationsint20Max task iterations
timeout_secondsfloat300.0Task timeout
enable_planningbooltrueEnable task planning
enable_reasoningbooltrueEnable reasoning strategies
enable_draftingboolfalseEnable drafting
enable_memorybooltrueEnable memory system
enable_toolsbooltrueEnable MCP tools
default_reasoning_strategystring"auto"Strategy: "auto", "cot", "tot", "react", "reflection"
allowed_toolslist[string]nullWhitelist tools (null = all)
blocked_toolslist[string]nullBlacklist tools
max_tool_roundsint10Max tool round-trips

Memory Models

Defined in kit/agent_memory/models.py.

Turn

FieldTypeDefaultDescription
idstringauto UUIDTurn identifier
conversation_idstringrequiredParent conversation
indexintrequiredPosition in conversation
timestampdatetimenow (UTC)When the turn occurred
rolestringrequired"user", "assistant", "system", "tool"
contentstringrequiredMessage content
embeddinglist[float]nullVector embedding
token_countintnullToken count
metadatadict{}Extra data (model, latency, etc.)
channelstring"_global"Memory channel

Entity

FieldTypeDefaultDescription
idstringauto UUIDEntity identifier
namestringrequiredEntity name
typestringrequired"Person", "Organization", "Concept", etc.
aliaseslist[string][]Alternative names
descriptionstringnullEntity description
embeddinglist[float]nullVector embedding
saliencefloat0.5Importance score (0–1)
propertiesdict{}Arbitrary key-value properties
first_seendatetimenowWhen first encountered
last_accesseddatetimenowLast retrieval time
access_countint0Retrieval count
channelstring"_global"Memory channel

Fact

FieldTypeDefaultDescription
idstringauto UUIDFact identifier
claimstringrequiredThe factual claim
claim_hashstringautoSHA256 hash for duplicate detection
confidencefloat0.8Confidence score (0–1)
sourcestringrequired"extraction", "user_stated", "inferred"
source_turn_idstringnullTurn this fact was extracted from
entity_idslist[string][]Linked entities
embeddinglist[float]nullVector embedding
created_atdatetimenowCreation time
channelstring"_global"Memory channel
last_accesseddatetimenowLast retrieval time
access_countint0Retrieval count
saliencefloat0.5Importance score
temporal_contextstringnull"current", "past", "future"
superseded_atdatetimenullWhen superseded by correction
superseded_by_idstringnullID of superseding fact
supersedes_idstringnullID of fact this supersedes
flagged_for_reviewboolfalseFlagged for contradiction review

Goal

FieldTypeDefaultDescription
idstringauto UUIDGoal identifier
descriptionstringrequiredGoal description
statusstring"active""active", "completed", "abandoned", "blocked"
priorityint3Priority 1–5
parent_goal_idstringnullParent goal for hierarchy
embeddinglist[float]nullVector embedding
created_atdatetimenowCreation time
deadlinedatetimenullOptional deadline
channelstring"_global"Memory channel

Strategy

FieldTypeDefaultDescription
idstringauto UUIDStrategy identifier
descriptionstringrequiredStrategy description
context_patternstringrequiredMatching pattern (regex/keywords)
tool_sequencelist[string][]Ordered tool names
embeddinglist[float]nullVector embedding
success_countint0Successful uses
failure_countint0Failed uses
last_useddatetimenullLast invocation
channelstring"_global"Memory channel

MemoryBundle

Aggregated retrieval result returned by AgentMemory.remember().

FieldTypeDescription
relevant_turnslist[dict]Recent relevant conversation turns
entitieslist[dict]Matching entities
factslist[dict]Relevant facts
strategieslist[dict]Applicable strategies
active_goalslist[dict]Current active goals
user_contextdictUser-level context

Has a to_context_string() method that formats the bundle for LLM prompt injection.


Prompt Models

Defined in prompts/models.py.

PromptSection

FieldTypeDescription
idstringUnique section identifier
namestringDisplay name
typeSectionType"persona", "task", "format", "constraints", "examples", "context", "custom"
contentstringPrompt text
enabledboolWhether active in composition
orderintSort order within profile

PromptProfile

FieldTypeDescription
idstringUnique profile identifier
namestringDisplay name
descriptionstringUsage description
sectionslist[PromptSection]Ordered sections
is_defaultboolWhether this is the default profile

GlobalPrompt

FieldTypeDescription
contentstringGlobal prompt text
enabledboolWhether active

PromptConfig

Combines all prompt components for a request.

FieldTypeDescription
global_promptGlobalPromptCore persona prompt
profilePromptProfileSelected profile
mcp_tools_promptstringAuto-generated tools prompt
structured_outputStructuredOutputConfigOutput constraints
additional_contextstringRequest-specific context
system_overridestringReplaces entire system prompt

Composition order: Global prompt → MCP tools → Profile sections → Additional context.


MCP Models

ServerConfig (@dataclass, defined in mcp/server_registry.py)

FieldTypeDescription
namestringServer identifier
transportTransportType"stdio", "sse", "streamable_http"
commandstringCommand for stdio transport
argslist[string]Command arguments
envdictEnvironment variables (resolved from $VAR syntax)
urlstringURL for SSE/HTTP transport
headersdictHTTP headers (env vars resolved)

ToolInfo (@dataclass, defined in mcp/tool_executor.py)

FieldTypeDescription
namestringTool name
descriptionstringTool description
input_schemadictJSON Schema for parameters
server_namestringSource server

ResourceInfo (@dataclass, defined in mcp/client.py)

FieldTypeDescription
uristringResource URI
namestringResource name
descriptionstringResource description
mime_typestringContent type
server_namestringSource server

SSE Event Schemas

Events emitted by POST /api/agent/chat/stream:

EventSchema
start{"task_id": string, "model": string}
chunk{"content": string}
tool_call{"tool": string, "arguments": dict}
tool_result{"tool": string, "content": string}
done{"task_id": string, "thinking": string?, "has_thinking": bool, "total_time_ms": float, "session_id": string}
error{"error": string}