Skip to content

Agents

Agents are the core of Komand. Each agent is an AI personality with its own model, system prompt, enabled skills, memory, and conversation history. A single Komand instance can run multiple agents — a sales bot, a support agent, an internal assistant — each with separate configuration and isolated state.

Terminal window
curl -X POST http://localhost:5000/api/agents/ \
-H "Content-Type: application/json" \
-d '{
"agentId": "sales-bot",
"name": "Sales Assistant",
"description": "Handles inbound leads and product inquiries",
"systemPrompt": "You are a friendly sales assistant for Acme Corp. Help customers with product inquiries, pricing, and scheduling demos.",
"modelProvider": "anthropic",
"modelId": "claude-sonnet-4-20250514",
"maxContextTokens": 100000,
"enabledSkillIds": ["crm-contact-lookup", "quote-builder", "calendar-book"],
"allowedChannels": ["WebChat", "Slack", "Telegram"]
}'
FieldTypeDefaultDescription
agentIdstringUnique identifier (required)
namestringDisplay name (required)
descriptionstringnullHuman-readable description
systemPromptstring"You are a helpful enterprise AI assistant."Instructions that shape the agent’s behaviour
modelProviderstring"anthropic"AI provider to use
modelIdstring"claude-sonnet-4-20250514"Specific model within the provider
maxContextTokensint100,000Maximum context window for LLM calls
enabledSkillIdsstring[][]Skill IDs the agent can invoke
allowedChannelsstring[][]Channels the agent can operate on
createdAtdatetime(auto)When the agent was created
updatedAtdatetime(auto)When the agent was last modified

The systemPrompt is prepended to every LLM call. It defines the agent’s personality, knowledge boundaries, and behavioral guidelines.

Terminal window
curl http://localhost:5000/api/agents/sales-bot

Response:

{
"success": true,
"data": {
"agentId": "sales-bot",
"name": "Sales Assistant",
"description": "Handles inbound leads and product inquiries",
"systemPrompt": "You are a friendly sales assistant...",
"modelProvider": "anthropic",
"modelId": "claude-sonnet-4-20250514",
"maxContextTokens": 100000,
"enabledSkillIds": ["crm-contact-lookup", "quote-builder", "calendar-book"],
"allowedChannels": ["WebChat", "Slack", "Telegram"]
}
}

Each agent maintains separate conversation histories per session. A session is identified by the channel, account, and sender — see Sessions for details.

Get the last 50 turns from a session:

Terminal window
curl "http://localhost:5000/api/agents/sales-bot/history/session-123?maxTurns=50"

Response:

{
"success": true,
"data": [
{
"role": "user",
"content": "What's the pricing for your Pro plan?",
"timestamp": "2026-02-23T10:30:00Z",
"toolCallIds": null
},
{
"role": "assistant",
"content": "The Pro plan is $49/month per user...",
"timestamp": "2026-02-23T10:30:02Z",
"toolCallIds": null
}
]
}

Clear a session’s history:

Terminal window
curl -X DELETE http://localhost:5000/api/agents/sales-bot/history/session-123
  • When a session exceeds MaxTurnsPerSession (default 100), the oldest turns are trimmed before adding new ones
  • When the agent exceeds MaxSessionsPerAgent (default 100), the oldest session (by last activity) is automatically evicted
  • Clearing a session’s history does not end the session — new messages continue to accumulate

Agents have a persistent key-value memory store that persists across sessions and channels. This is for long-term facts — preferences, learned context, user information — not conversation history.

Store a memory:

Terminal window
curl -X POST http://localhost:5000/api/agents/sales-bot/memory \
-H "Content-Type: application/json" \
-d '{ "key": "company_timezone", "value": "Australia/Brisbane" }'

Recall a memory:

Terminal window
curl http://localhost:5000/api/agents/sales-bot/memory/company_timezone

Memory is scoped to the agent, not the session. Information stored during a Telegram conversation is available when the same agent handles a Slack conversation. This enables cross-channel continuity:

[Telegram] You: "Our office is in Brisbane"
[Telegram] Agent: "Got it — I'll use Australia/Brisbane for scheduling."
... later ...
[Slack] You: "Book a meeting for 2pm tomorrow"
[Slack] Agent: "Booked for 2:00 PM AEST (Australia/Brisbane)."
SettingDefault
Max entries per agent1,000
Max value length100,000 characters

When the entry limit is reached, you must delete existing entries before storing new ones.

You can run multiple agents for different purposes:

AgentPurposeChannels
defaultGeneral assistantAll
sales-botLead qualification, demosWebChat, Slack
support-botCustomer support, troubleshootingTelegram, WhatsApp
internal-botTeam operations, status checksTeams, Discord

Sessions are bound to a specific agent. By default, new sessions bind to the "default" agent. You can rebind sessions to different agents — see Sessions.

In V1, users provide their own API key for AI providers. Komand supports any provider with an OpenAI-compatible API, with first-class support for Anthropic Claude models.

Configure the model per agent:

{
"modelProvider": "anthropic",
"modelId": "claude-sonnet-4-20250514",
"maxContextTokens": 100000
}

API keys will be stored in the platform’s credential vault and never exposed in agent configuration or logs.

In V2, Komand will offer a managed AI gateway that handles model routing, rate limiting, and usage tracking — no API key required.

All limits are configurable via the GrainLimits configuration section:

SettingDefaultDescription
MaxTurnsPerSession100Oldest turns trimmed when exceeded
MaxSessionsPerAgent100Oldest session evicted when exceeded
MaxMemoryEntries1,000Per-agent memory capacity
MaxMemoryValueLength100,000Characters per memory value