Cereal docs
TypeScript SDKTypeScript signatures

DefinedAgent

Public TypeScript declaration from @trycereal/sdk.

Import from @trycereal/sdk. Generated from the repository SDK declarations (package version 0.0.0); not from HTTP request schemas.

export interface DefinedAgent {
    definition(options?: {
        readonly connectionSlug?: string;
        readonly namespace?: string;
    }): AgentDefinition;
    readonly fetch: WebHandler;
    readonly paths: {
        readonly mcp: string;
        readonly hooks: string;
    };
    readonly subagents: ReadonlyArray<DefinedAgent>;
    readonly handlers: CerealHandlers;
    toNextRouteHandlers(): CerealHandlers;
    sync(options?: SyncOptions): Promise<SyncResult>;
    readonly sessions: {
        feedback: CerealClient["sessions"]["feedback"];
        evaluations: CerealClient["sessions"]["evaluations"];
        evaluate: CerealClient["sessions"]["evaluate"];
        start(input?: {
            readonly experiment?: import("./types.js").ExperimentSelection;
            readonly idempotencyKey?: string;
            readonly message?: string;
            readonly overrides?: SessionOverrides;
            readonly metadata?: SessionMetadata;
            readonly identity?: Identity;
        }): Promise<{
            readonly id: string;
            readonly experiment?: import("./types.js").ExperimentAssignment;
        }>;
        send(input: {
            readonly id: string;
            readonly message: string;
            readonly identity?: Identity;
            readonly metadata?: MessageMetadata;
        }): Promise<SessionEvent>;
        children(id: string, options?: {
            readonly recursive?: boolean;
        }): Promise<ReadonlyArray<Session>>;
        stream(id: string, options?: {
            readonly after?: number;
            readonly signal?: AbortSignal;
        }): AsyncIterable<StreamedEvent>;
        streamToken(input: {
            readonly id: string;
            readonly format?: StreamFormat;
            readonly ttlSeconds?: number;
            readonly include?: ReadonlyArray<StreamInclude>;
        }): Promise<StreamTokenIssued>;
    };
    readonly approvals: {
        pending(sessionId: string): Promise<ReadonlyArray<PendingDecision>>;
        allow(sessionId: string, toolCallId: string, options?: {
            readonly message?: string;
            readonly input?: unknown;
            readonly actor?: string;
        }): Promise<Session>;
        deny(sessionId: string, toolCallId: string, options?: {
            readonly message?: string;
            readonly actor?: string;
        }): Promise<Session>;
    };
    readonly authorizations: {
        pending(sessionId: string): Promise<ReadonlyArray<PendingAuthorization>>;
    };
    readonly tools: ReadonlyArray<CerealTool>;
    readonly slug: string;
    init(options?: CerealInitOptions): Promise<void>;
    close(): Promise<void>;
}

See SDK setup, authoring, client behavior, and the API/SDK map for usage. Domain types are described in schema reference.

Related SDK types: SyncOptions, SyncResult, CerealHandlers, WebHandler, CerealInitOptions, CerealTool.