OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

agent-console.agent.create

Creates a new AI agent configuration.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @agent-console-team
  • Tags: agent, create
  • File: packages/examples/agent-console/src/agent/agent.operation.ts
  • field.key.label
    agent-console.agent.create
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    agent-console.agent.create
    field.description.label

    Creates a new AI agent configuration.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @agent-console-team
  • Tags: agent, create
  • File: packages/examples/agent-console/src/agent/agent.operation.ts
  • field.tags.label
    agent,create
    field.owners.label
    @agent-console-team
    field.stability.label
    stable

    Creates a new AI agent configuration.

    Goal

    Allow users to define new AI agents with specific models and tools.

    Context

    Called from the agent builder UI when creating a new agent.

    Source Definition

    import {
    	defineCommand,
    	defineQuery,
    } from '@lssm-tech/lib.contracts-spec/operations';
    import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
    import { AgentStatusEnum, ModelProviderEnum } from './agent.enum';
    import { AgentCreatedEvent } from './agent.event';
    import {
    	AgentSummaryModel,
    	AgentWithToolsModel,
    	CreateAgentInputModel,
    	UpdateAgentInputModel,
    } from './agent.schema';
    
    export const CreateAgentCommand = defineCommand({
    	meta: {
    		key: 'agent-console.agent.create',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@agent-console-team'],
    		tags: ['agent', 'create'],
    		description: 'Creates a new AI agent configuration.',
    		goal: 'Allow users to define new AI agents with specific models and tools.',
    		context: 'Called from the agent builder UI when creating a new agent.',
    	},
    	io: {
    		input: CreateAgentInputModel,
    		output: defineSchemaModel({
    			name: 'CreateAgentOutput',
    			fields: {
    				id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
    				name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
    				slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
    				status: { type: AgentStatusEnum, isOptional: false },
    			},
    		}),
    		errors: {
    			SLUG_EXISTS: {
    				description:
    					'An agent with this slug already exists in the organization',
    				http: 409,
    				gqlCode: 'SLUG_EXISTS',
    				when: 'Slug is already taken',
    			},
    		},
    	},
    	policy: { auth: 'user' },
    	sideEffects: {
    		emits: [
    			{
    				// name: 'agent.created',
    				// version: '1.0.0',
    				// payload: AgentSummaryModel,
    				ref: AgentCreatedEvent.meta,
    				when: 'Agent is successfully created',
    			},
    		],
    		audit: ['agent-console.agent.created'],
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'create-agent-happy-path',
    				given: ['User is authenticated', 'Organization exists'],
    				when: ['User submits valid agent configuration'],
    				then: [
    					'New agent is created with DRAFT status',
    					'AgentCreated event is emitted',
    				],
    			},
    			{
    				key: 'create-agent-slug-conflict',
    				given: ['User is authenticated', 'Agent with same slug exists'],
    				when: ['User submits agent with duplicate slug'],
    				then: ['SLUG_EXISTS error is returned with 409 status'],
    			},
    		],
    		examples: [
    			{
    				key: 'basic-create',
    				input: {
    					name: 'Support Assistant',
    					slug: 'support-assistant',
    					modelProvider: 'openai',
    					modelId: 'gpt-4',
    				},
    				output: {
    					id: 'agent-123',
    					name: 'Support Assistant',
    					slug: 'support-assistant',
    					status: 'draft',
    				},
    			},
    		],
    	},
    });