import type { BuiltinToolName, AgentDefinition as HarnessAgentDefinition, BuilderState as HarnessBuilderState, WorkflowDefinition as HarnessWorkflowDefinition } from '@purista/harness'; import type { SupportedHttpMethod } from '../core/HttpServer/types/SupportedHttpMethod.js'; import type { PuristaMetricDefinition } from '../core/types/PuristaMetrics.js'; import type { Infer, InferIn, Schema } from '../schema/index.js'; import type { AgentExecutionPolicy, AgentHandler, AgentHarnessWorkflowOptions, AgentHttpExposure, AgentManifest, AgentModelBinding, AgentQueueBuilderTypes, AgentResponseMode, AgentResponseModeOptions, AgentSandboxPolicy, AgentSessionPolicy, AgentWorkspacePolicy, AllowedAgentDefinition, AllowedCommandToolDefinition, AnyAgentQueueBuilderTypes, AttachedAgentDefinition } from './types.js'; /** * Builds an attached PURISTA agent from normal core queue, worker, command, * stream definitions, and a provider-neutral agent manifest. * * @example * ```ts * const triage = service * .getAgentQueueBuilder('supportTriage', 'Classifies tickets') * .addModel('primary', { model: 'gpt-4.1-mini', capabilities: ['object'] }) * .setRunFunction(async context => ({ priority: 'high' })) * ``` */ export declare class AgentQueueBuilder { private readonly serviceName; private readonly serviceVersion; private readonly agentName; private readonly description; private payloadSchema?; private parameterSchema?; private outputSchema?; private models; private commandTools; private agentInvokes; private skills; private builtInTools; private executionPolicy; private sessionPolicy; private sandboxPolicy?; private workspacePolicy?; private httpExposure?; private streamingMode; private successEventName?; private executionProfile?; private responseMode?; private executionDefinitions; private metricDefinitions; constructor(serviceName: string, serviceVersion: string, agentName: string, description: string); /** * Declare a custom application metric available only in this agent handler. * * @example * ```ts * agent.defineMetric('app.agent.escalations', { * kind: 'counter', * unit: '{escalation}', * description: 'Escalated agent runs', * }) * ``` */ defineMetric>(name: MetricName, definition: Definition): AgentQueueBuilder>; /** Add the payload schema used by the generated queue, command, stream, and agent handler. */ addPayloadSchema(schema: PayloadSchema): AgentQueueBuilder>; /** Add the parameter schema used by the generated queue, command, stream, and agent handler. */ addParameterSchema(schema: ParameterSchema): AgentQueueBuilder>; /** Add the final output schema returned by the agent command or aggregate stream response. */ addOutputSchema(schema: OutputSchema): AgentQueueBuilder>; /** * Declare a model alias that must be bound when the owning service is instantiated. * * @example * ```ts * agent.addModel('primary', { * model: 'gpt-4.1-mini', * capabilities: ['object'], * }) * ``` */ addModel(alias: Alias, binding: Binding): AgentQueueBuilder, S['CommandTools'], S['AgentTools'], S['Execution'], S['Metrics']>>; /** Declare named skill references the runtime can load for this agent. */ useSkills(names: readonly string[], resourceName?: string): this; /** Restrict or disable harness built-in tools for this agent. */ useBuiltInTools(namesOrFalse: readonly BuiltinToolName[] | false): this; /** * Allow the agent handler to call a PURISTA command through `context.invoke.tools`. * * @example * ```ts * agent.canInvoke('billing', '1', 'getInvoice', { * outputSchema: invoiceSchema, * payloadSchema: invoiceLookupSchema, * }) * ``` */ canInvoke(serviceName: ServiceName, serviceVersion: Version, commandName: CommandName, schemas?: { outputSchema?: Output; payloadSchema?: Payload; parameterSchema?: Parameter; }): AgentQueueBuilder>, S['AgentTools'], S['Execution'], S['Metrics']>>; /** * Allow this agent to call another attached agent through `context.invoke.agents`. * * @example * ```ts * agent.canInvokeAgent('summarizeTicket', '1', { * payloadSchema: ticketSchema, * outputSchema: summarySchema, * }) * ``` */ canInvokeAgent(agentName: AgentName, serviceVersion: Version, schemas?: { outputSchema?: Output; payloadSchema?: Payload; parameterSchema?: Parameter; }): AgentQueueBuilder>, S['Execution'], S['Metrics']>>; /** Use a provider-neutral `@purista/harness` agent definition as this agent's execution. */ setHarnessAgent(this: AgentQueueBuilder>, definition: HarnessAgentDefinition): AgentQueueBuilder>; /** * Use a provider-neutral `@purista/harness` workflow definition as this agent's execution. * * Pass harness-local agent definitions in `options.agents` when the workflow * handler calls `ctx.agents.(...)`. Those agents run inside the same * harness session, sandbox, telemetry setup, and durable workflow boundary as * this attached PURISTA agent. * * @example * ```ts * service * .getAgentQueueBuilder('incidentReview', 'Reviews one incident') * .addModel('primary', { model: 'gpt-4.1-mini', capabilities: ['object'] }) * .setHarnessWorkflow(reviewWorkflow, { * agents: { summarize: summarizeAgent }, * }) * ``` */ setHarnessWorkflow> = Record, Definition extends HarnessWorkflowDefinition = HarnessWorkflowDefinition>(this: AgentQueueBuilder>, definition: Definition, options?: AgentHarnessWorkflowOptions & { agents?: Agents; }): AgentQueueBuilder>; /** * Use a plain async run function as this agent's execution. * * @example * ```ts * agent.setRunFunction(async context => { * context.metrics['app.agent.runs'].add(1) * return { answer: `Ticket ${context.payload.ticketId} queued` } * }) * ``` */ setRunFunction(this: AgentQueueBuilder>, handler: AgentHandler, InferIn, S['Resources'], S['Models'], S['CommandTools'], S['AgentTools'], Infer, S['Metrics']>): AgentQueueBuilder>; /** Merge queue worker execution policy for the generated agent worker and queue. */ setExecutionPolicy(policy: AgentExecutionPolicy): this; /** * Apply a core queue execution profile to the generated agent queue. * * @example * ```ts * agent.setExecutionProfile('longRunning', { * maxRuntimeMs: 30 * 60_000, * }) * ``` */ setExecutionProfile(profile: 'longRunning', options: { maxRuntimeMs: number; strict?: boolean; }): this; /** * Configure how a queued agent run exposes its final result contract. * * Long-running response modes enqueue the agent queue and keep `jobId` and * agent `runId` as separate metadata in the generated definitions. * * @example * ```ts * agent.setResponseMode('accepted', { * resultPolicy: 'state-and-event', * }) * ``` */ setResponseMode(mode: AgentResponseMode, options?: AgentResponseModeOptions): this; /** Configure harness session behavior for this attached agent. */ setSessionPolicy(policy: AgentSessionPolicy): this; /** Attach sandbox configuration consumed by compatible agent runtimes. */ setSandboxPolicy(policy: AgentSandboxPolicy): this; /** Require a durable harness workspace for this attached agent. */ setWorkspacePolicy(policy: AgentWorkspacePolicy): this; /** * Expose the generated agent command or stream as an HTTP endpoint. * * Use `streamingMode: 'aggregate'` to expose the command projection and * `streamingMode: 'stream'` to expose the stream projection. * * @example * ```ts * agent.exposeAsHttpEndpoint('POST', 'support/triage', { * streamingMode: 'aggregate', * responseContentType: 'application/json', * }) * ``` */ exposeAsHttpEndpoint(method: SupportedHttpMethod, path: string, options?: Omit): this; /** Choose whether the generated HTTP projection streams chunks or returns an aggregate response. */ setStreamingMode(mode: 'stream' | 'aggregate'): this; /** Mark the generated HTTP endpoint public in OpenAPI/security metadata. */ makeEndpointPublic(): this; /** Set the success event name used by generated command and result policies. */ setSuccessEventName(eventName: string): this; /** Return the provider-neutral manifest for this agent without generating core definitions. */ getManifest(): AgentManifest; /** Generate the attached agent and its queue, worker, command, and stream definitions. */ getDefinition(): Promise>; private resolveExecution; private assertNoExecutionDefinition; private createManifest; private getQueueName; private resolveResultPolicy; } //# sourceMappingURL=AgentQueueBuilder.d.ts.map