Skip to content

Agent Configuration Schema

Complete reference for the AgentDefinition type used to configure LLM agents in Pika Platform.

import type { AgentDefinition } from 'pika-shared/types/chatbot/chatbot-types';
FieldTypeDescription
agentIdstringUnique agent identifier (e.g., 'weather-bot')
basePromptstringSystem prompt template. Can use handlebars placeholders like {{user.email}}
toolIdsstring[]Array of tool IDs that this agent can use
createdBystringUser ID who created the agent
lastModifiedBystringUser ID who last modified the agent
createdAtstringISO 8601 formatted creation timestamp
updatedAtstringISO 8601 formatted last update timestamp
versionnumberAgent definition version number
FieldTypeDefaultDescription
foundationModelstringSystem defaultFoundation model to use for this agent (e.g., anthropic.claude-3-5-sonnet-20241022-v2:0)
verificationFoundationModelstringSystem defaultFoundation model to use for verifying responses (self-correcting feature)
FieldTypeDescription
accessRulesAccessRule[]List of access control rules with conditions. If not provided, agent is accessible to all users

AccessRule Interface:

interface AccessRule {
condition?: string; // Expression like "user.scope IN ['admin'] AND account.type = 'retailer'"
effect: 'allow' | 'deny';
order?: number; // Lower numbers evaluated first
description?: string;
}
FieldTypeDescription
rolloutPolicyRolloutPolicyGating configuration per account/organization/region

RolloutPolicy Interface:

interface RolloutPolicy {
betaAccounts?: string[]; // Account IDs that can access this agent
regionRestrictions?: string[]; // AWS regions where agent is available
toolOverrides?: Record<string, string>; // Map old tool IDs to new tool IDs
}
FieldTypeDescription
collaboratorsCollaborator[]List of other agents used to orchestrate this agent
agentCollaborationAgentCollaborationType of collaboration pattern used

Collaborator Interface:

interface Collaborator {
agentId: string;
instruction: string;
historyRelay: 'TO_COLLABORATOR' | 'TO_AGENT';
}
FieldTypeDescription
knowledgeBasesKnowledgeBase[]List of knowledge bases associated with this agent

KnowledgeBase Interface:

interface KnowledgeBase {
id: string; // Unique identifier for the knowledge base
// Additional configuration fields...
}
FieldTypeDescription
runtimeAdapterstringOptional Lambda ARN for augmenting prompt/session context (future feature)
dontCacheThisbooleanSet to true during development to bypass caching
testType'mock'Set to 'mock' for test agents that auto-delete after 1 day
import type { AgentDefinition } from 'pika-shared/types/chatbot/chatbot-types';
const agent: AgentDefinition = {
agentId: 'customer-support-agent',
foundationModel: 'anthropic.claude-3-5-sonnet-20241022-v2:0',
verificationFoundationModel: 'anthropic.claude-3-5-sonnet-20241022-v2:0',
basePrompt: `You are a helpful customer support agent for {{company.name}}.
The user you are helping is {{user.firstName}} {{user.lastName}} ({{user.email}}).
Their account type is {{customData.accountType}}.
Always be professional, helpful, and concise in your responses.`,
toolIds: [
'customer-lookup',
'order-status-check',
'knowledge-base-search'
],
knowledgeBases: [
{
id: 'kb-product-docs'
}
],
accessRules: [
{
effect: 'allow',
condition: "user.userType = 'internal-user'",
order: 1,
description: 'Allow all internal users'
},
{
effect: 'allow',
condition: "user.userType = 'external-user' AND customData.accountType IN ['premium', 'enterprise']",
order: 2,
description: 'Allow premium and enterprise customers'
},
{
effect: 'deny',
order: 999,
description: 'Deny all others'
}
],
rolloutPolicy: {
betaAccounts: ['account-123', 'account-456'],
regionRestrictions: ['us-east-1', 'us-west-2']
},
version: 1,
createdBy: 'admin@example.com',
lastModifiedBy: 'admin@example.com',
createdAt: '2024-01-15T10:00:00Z',
updatedAt: '2024-01-15T10:00:00Z'
};
const simpleAgent: AgentDefinition = {
agentId: 'simple-chatbot',
basePrompt: 'You are a helpful AI assistant.',
toolIds: [],
version: 1,
createdBy: 'system',
lastModifiedBy: 'system',
createdAt: '2024-01-15T10:00:00Z',
updatedAt: '2024-01-15T10:00:00Z'
};

The basePrompt field supports handlebars template syntax with access to:

VariableDescriptionExample
user.emailUser's email addressjohn@example.com
user.firstNameUser's first nameJohn
user.lastNameUser's last nameDoe
user.userIdUnique user identifieruser-123
user.userTypeUser typeinternal-user or external-user
customData.*Any custom user data field{{customData.accountId}}
company.nameYour company name (from config)Acme Corp

Use AgentDataRequest type:

import type { AgentDataRequest } from 'pika-shared/types/chatbot/chatbot-types';
const request: AgentDataRequest = {
agent: {
agentId: 'my-agent',
basePrompt: 'You are a helpful assistant.',
toolIds: ['tool-1', 'tool-2'],
// ... other fields (omit version, timestamps, created/modified by)
},
userId: 'cloudformation/my-stack-name'
};

Use AgentDefinitionForUpdate type:

import type { AgentDefinitionForUpdate } from 'pika-shared/types/chatbot/chatbot-types';
const update: AgentDefinitionForUpdate = {
agentId: 'my-agent',
basePrompt: 'Updated prompt',
toolIds: ['tool-1', 'tool-2', 'tool-3']
// Only include fields you want to update
};
  • agentId - Must be unique, alphanumeric with hyphens/underscores only
  • basePrompt - No strict length limit, but keep under 4000 characters for best performance
  • toolIds - Must reference existing tools in the tool definitions table
  • accessRules - Conditions must use valid CEL (Common Expression Language) syntax
  • version - Automatically incremented by the system on updates
  • POST /api/chat-admin/agent - Create or update agent
  • GET /api/chat-admin/agent/{agentId} - Get agent definition
  • DELETE /api/chat-admin/agent/{agentId} - Delete agent
  • POST /api/chat-admin/agents/search - Search agents

See REST API Reference for complete API documentation.