diff --git a/src/main/apiServer/routes/agents/handlers/agents.ts b/src/main/apiServer/routes/agents/handlers/agents.ts index 6e35f12c80..dc9e4ecf52 100644 --- a/src/main/apiServer/routes/agents/handlers/agents.ts +++ b/src/main/apiServer/routes/agents/handlers/agents.ts @@ -1,5 +1,5 @@ import { loggerService } from '@logger' -import { AgentModelValidationError, agentService } from '@main/services/agents' +import { AgentModelValidationError, agentService, sessionService } from '@main/services/agents' import { ListAgentsResponse, type ReplaceAgentRequest, type UpdateAgentRequest } from '@types' import { Request, Response } from 'express' @@ -20,7 +20,8 @@ const modelValidationErrorBody = (error: AgentModelValidationError) => ({ * /v1/agents: * post: * summary: Create a new agent - * description: Creates a new autonomous agent with the specified configuration + * description: Creates a new autonomous agent with the specified configuration and automatically + * provisions an initial session that mirrors the agent's settings. * tags: [Agents] * requestBody: * required: true @@ -55,8 +56,37 @@ export const createAgent = async (req: Request, res: Response): Promise { + async createSession( + agentId: string, + req: Partial = {} + ): Promise { this.ensureInitialized() // Validate agent exists - we'll need to import AgentService for this check