agentbay_agent_register
Register an agent with AgentBay to create a Knowledge Brain linked to your API key. Required before using agent memory tools for storing, recalling, and sharing knowledge across sessions.
Instructions
Register this agent with AgentBay. Required before using agent memory tools (agent_memory_record, agent_memory_query). Creates a Knowledge Brain and links it to your API key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Agent name (e.g., "codex", "my-agent") | |
| description | No | Agent description | |
| framework | No | Agent framework (codex, openclaw, langchain, crewai, custom) |
Implementation Reference
- src/index.ts:947-964 (handler)The 'agentbay_agent_register' tool handler function registered via server.tool(). It calls POST /api/v1/brain/setup with name, description, and framework to register the agent with AgentBay.
server.tool( 'agentbay_agent_register', 'Register this agent with AgentBay. Required before using agent memory tools (agent_memory_record, agent_memory_query). Creates a Knowledge Brain and links it to your API key.', { name: z.string().describe('Agent name (e.g., "codex", "my-agent")'), description: z.string().optional().describe('Agent description'), framework: z.string().optional().describe('Agent framework (codex, openclaw, langchain, crewai, custom)'), }, async ({ name: brainName, description: brainDesc, framework: fw }) => { const data = await apiPost('/api/v1/brain/setup', { name: brainName, description: brainDesc, framework: fw, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: `Agent registered!\n\nAgent ID: ${data.agentId}\nProject ID: ${data.projectId}\n\nYou can now use agentbay_agent_memory_record and agentbay_agent_memory_query.` }] }; } ); - src/index.ts:947-964 (schema)The Zod schema for agentbay_agent_register: accepts 'name' (string, required), 'description' (string, optional), and 'framework' (string, optional).
server.tool( 'agentbay_agent_register', 'Register this agent with AgentBay. Required before using agent memory tools (agent_memory_record, agent_memory_query). Creates a Knowledge Brain and links it to your API key.', { name: z.string().describe('Agent name (e.g., "codex", "my-agent")'), description: z.string().optional().describe('Agent description'), framework: z.string().optional().describe('Agent framework (codex, openclaw, langchain, crewai, custom)'), }, async ({ name: brainName, description: brainDesc, framework: fw }) => { const data = await apiPost('/api/v1/brain/setup', { name: brainName, description: brainDesc, framework: fw, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: `Agent registered!\n\nAgent ID: ${data.agentId}\nProject ID: ${data.projectId}\n\nYou can now use agentbay_agent_memory_record and agentbay_agent_memory_query.` }] }; } ); - src/index.ts:947-964 (registration)Registration of the tool with MCP server using server.tool() with name 'agentbay_agent_register' on line 947.
server.tool( 'agentbay_agent_register', 'Register this agent with AgentBay. Required before using agent memory tools (agent_memory_record, agent_memory_query). Creates a Knowledge Brain and links it to your API key.', { name: z.string().describe('Agent name (e.g., "codex", "my-agent")'), description: z.string().optional().describe('Agent description'), framework: z.string().optional().describe('Agent framework (codex, openclaw, langchain, crewai, custom)'), }, async ({ name: brainName, description: brainDesc, framework: fw }) => { const data = await apiPost('/api/v1/brain/setup', { name: brainName, description: brainDesc, framework: fw, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: `Agent registered!\n\nAgent ID: ${data.agentId}\nProject ID: ${data.projectId}\n\nYou can now use agentbay_agent_memory_record and agentbay_agent_memory_query.` }] }; } ); - src/index.ts:407-407 (helper)Reference to agentbay_agent_register in error message: 'No agent linked to this API key. Use agentbay_agent_register first.' in the agent_memory_record tool.
if (!agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key. Use agentbay_agent_register first.' }] }; - src/index.ts:434-434 (helper)Reference to agentbay_agent_register in error message: 'No agent linked to this API key. Use agentbay_agent_register first.' in the agent_memory_query tool.
if (!agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key. Use agentbay_agent_register first.' }] };