Skip to main content
Glama

create_agent

Create a new Letta agent with custom configuration, name, and description to manage conversations, tools, and memory blocks within the Letta system.

Instructions

Create a new Letta agent with specified configuration. After creation, use attach_tool to add capabilities, attach_memory_block to configure memory, or prompt_agent to start conversations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the new agent
descriptionYesDescription of the agent's purpose/role
modelNoThe model to use for the agentopenai/gpt-4
embeddingNoThe embedding model to useopenai/text-embedding-ada-002

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesUnique identifier of the created agent
capabilitiesNoList of tool names attached to the agent

Implementation Reference

  • The handler function that validates inputs, configures the agent with LLM and embedding models, creates the agent via Letta API, retrieves its info, and returns the agent ID and capabilities.
    export async function handleCreateAgent(server, args) {
        try {
            // Validate arguments
            if (
                !args.name ||
                !args.description ||
                typeof args.name !== 'string' ||
                typeof args.description !== 'string'
            ) {
                throw new Error('Invalid arguments: name and description must be strings');
            }
    
            const model = args.model ?? 'openai/gpt-4';
            const embedding = args.embedding ?? 'openai/text-embedding-ada-002';
    
            // Determine model configuration based on the model handle
            let modelEndpointType = 'openai';
            let modelEndpoint = 'https://api.openai.com/v1';
            let modelName = model;
    
            // Handle special cases like letta-free
            if (model === 'letta/letta-free') {
                modelEndpointType = 'openai';
                modelEndpoint = 'https://inference.letta.com';
                modelName = 'letta-free';
            } else if (model.includes('/')) {
                // For other models with provider prefix
                const parts = model.split('/');
                modelEndpointType = parts[0];
                modelName = parts.slice(1).join('/');
            }
    
            // Agent configuration
            const agentConfig = {
                name: args.name,
                description: args.description,
                agent_type: 'memgpt_agent',
                model: model,
                llm_config: {
                    model: modelName,
                    model_endpoint_type: modelEndpointType,
                    model_endpoint: modelEndpoint,
                    context_window: 16000,
                    max_tokens: 1000,
                    temperature: 0.7,
                    frequency_penalty: 0.5,
                    presence_penalty: 0.5,
                    functions_config: {
                        allow: true,
                        functions: [],
                    },
                },
                embedding: embedding,
                parameters: {
                    context_window: 16000,
                    max_tokens: 1000,
                    temperature: 0.7,
                    presence_penalty: 0.5,
                    frequency_penalty: 0.5,
                },
                core_memory: {},
            };
    
            // Headers for API requests
            const headers = server.getApiHeaders();
    
            // Create agent
            const createAgentResponse = await server.api.post('/agents/', agentConfig, { headers });
            const agentId = createAgentResponse.data.id;
    
            // Update headers with agent ID
            headers['user_id'] = agentId;
    
            // Get agent info for the response
            const agentInfo = await server.api.get(`/agents/${agentId}`, { headers });
            const capabilities = agentInfo.data.tools?.map((t) => t.name) ?? [];
    
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            agent_id: agentId,
                            capabilities,
                        }),
                    },
                ],
                structuredContent: {
                    agent_id: agentId,
                    capabilities,
                },
            };
        } catch (error) {
            server.createErrorResponse(error);
        }
    }
  • Defines the tool name, description, input schema (name, description required; model and embedding optional), and output schema (agent_id required, capabilities optional).
    export const createAgentToolDefinition = {
        name: 'create_agent',
        description:
            'Create a new Letta agent with specified configuration. After creation, use attach_tool to add capabilities, attach_memory_block to configure memory, or prompt_agent to start conversations.',
        inputSchema: {
            type: 'object',
            properties: {
                name: {
                    type: 'string',
                    description: 'Name of the new agent',
                },
                description: {
                    type: 'string',
                    description: "Description of the agent's purpose/role",
                },
                model: {
                    type: 'string',
                    description: 'The model to use for the agent',
                    default: 'openai/gpt-4',
                },
                embedding: {
                    type: 'string',
                    description: 'The embedding model to use',
                    default: 'openai/text-embedding-ada-002',
                },
            },
            required: ['name', 'description'],
        },
        outputSchema: {
            type: 'object',
            properties: {
                agent_id: {
                    type: 'string',
                    description: 'Unique identifier of the created agent',
                },
                capabilities: {
                    type: 'array',
                    items: { type: 'string' },
                    description: 'List of tool names attached to the agent',
                },
            },
            required: ['agent_id'],
        },
    };
  • Registers the tool handler in the switch statement for CallToolRequestSchema, dispatching 'create_agent' calls to handleCreateAgent.
    case 'create_agent':
        return handleCreateAgent(server, request.params.arguments);
  • Includes the createAgentToolDefinition in the allTools array used to register tools for ListToolsRequestSchema.
    createAgentToolDefinition,
  • src/tools/index.js:5-5 (registration)
    Imports the handler and tool definition from the implementation file.
    import { handleCreateAgent, createAgentToolDefinition } from './agents/create-agent.js';
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds useful context about the post-creation workflow (attach_tool, attach_memory_block, prompt_agent), which goes beyond the annotations. However, it doesn't disclose behavioral traits like whether this operation is idempotent, what permissions are required, or how errors are handled. With annotations limited to just a title, the description carries more burden but provides only moderate behavioral insight.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with two sentences that each serve a distinct purpose: the first states the core function, and the second provides essential workflow guidance. There's zero wasted language, and the information is front-loaded with the primary action stated immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that this is a creation tool with 4 parameters, 100% schema coverage, and an output schema exists, the description provides good contextual completeness. It covers the purpose, distinguishes from siblings, and provides workflow guidance. The main gap is lack of behavioral details about the creation operation itself, but the existence of an output schema means return values don't need explanation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't add any parameter-specific information beyond what's already in the schema (which has 100% coverage). It mentions 'specified configuration' but doesn't elaborate on what parameters are available or their meanings. Since schema coverage is complete, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't need to given the comprehensive schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a new Letta agent') and resource ('with specified configuration'), distinguishing it from sibling tools like clone_agent, modify_agent, or import_agent. It explicitly defines the tool's function as initial agent creation rather than modification or duplication.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool versus alternatives by stating 'After creation, use attach_tool to add capabilities, attach_memory_block to configure memory, or prompt_agent to start conversations.' This clearly delineates the tool's role in the workflow and directs users to specific sibling tools for subsequent actions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oculairmedia/Letta-MCP-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server