import type { ExecutionEvent } from "../execution-events";
import type { RequestOptions } from "../base-client";
import type { StreamOptions } from "../streaming";
import { RequestBuilder } from "../request-builder";
/** A reference to a file in Storage for multimodal agent input. */
export interface FileInput {
    /** The UUID of the storage file (from `storage.requestUpload`). */
    storage_file_id: string;
    /** Optional label for this file (used in the LLM prompt as "--- File: {label} ---"). */
    label?: string;
}
/**
 * Execution record returned by the agent execution API.
 */
export interface Execution {
    id: string;
    agent_id: string;
    workspace_id: string;
    status: "pending" | "running" | "completed" | "failed" | "cancelled" | "awaiting_approval";
    input: Record<string, unknown>;
    result: Record<string, unknown> | null;
    triggered_by_user_id: string | null;
    total_tokens: number | null;
    total_credits_charged: string | null;
    model_used: string | null;
    requested_model_id: string | null;
    file_inputs?: FileInput[] | null;
    started_at: string | null;
    completed_at: string | null;
    created_at: string;
}
/**
 * Cost estimate returned by the estimate endpoint.
 */
export interface ExecutionEstimate {
    type: "execution-estimate";
    attributes: {
        min_credits: string;
        max_credits: string;
        max_iterations: number;
        estimated_tokens: {
            min: number;
            max: number;
        };
        model: string;
    };
}
/**
 * A node in the execution delegation tree.
 */
export interface ExecutionTreeNode {
    type: "execution-tree-node";
    id: string;
    attributes: {
        status: Execution["status"];
        depth: number;
        delegation_mode: string | null;
        own_credits_charged: string | null;
        child_credits_total: string | null;
        child_execution_count: number;
        started_at: string | null;
        completed_at: string | null;
    };
    relationships: {
        agent: {
            data: {
                type: "agent";
                id: string;
            };
        };
        parent_execution: {
            data: {
                type: "agent-execution";
                id: string;
            } | null;
        };
    };
    children: ExecutionTreeNode[];
}
/**
 * Agent execution namespace factory.
 *
 * Provides full lifecycle management for agent executions via the ISV API.
 * Supports starting executions, streaming SSE events, human-in-the-loop
 * approval/denial, cancellation, and multi-agent delegation tree queries.
 *
 * @param rb - The request builder used for API communication.
 * @returns Executions namespace with full lifecycle methods.
 */
export declare function createExecutionsNamespace(rb: RequestBuilder): {
    /**
     * Start a new agent execution.
     *
     * @param agentId - The UUID of the agent to execute.
     * @param input - Input data for the agent (task description, documents, etc.).
     * @param opts - Additional execution options.
     * @param opts.workspace_id - The workspace to execute in. Required when workspace
     *   is not inferrable from the API key.
     * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
     *   Highest priority in the model resolution chain.
     * @param opts.file_inputs - Array of {@link FileInput} references for multimodal input.
     *   Each entry points to a Storage file that will be injected into the agent's LLM context.
     * @returns The created execution record with status `pending`.
     *
     * @example
     * const exec = await admin.executions.start('agt_01...', {
     *   task: 'Process invoice batch',
     * }, { workspace_id: 'ws_abc123' });
     *
     * @example
     * // With model override
     * const exec = await admin.executions.start(
     *   'agt_01...',
     *   { task: 'Complex analysis' },
     *   { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
     * );
     */
    start(agentId: string, input: Record<string, unknown>, opts?: {
        workspace_id?: string;
        model_id?: string;
        file_inputs?: FileInput[];
    } & RequestOptions): Promise<Execution>;
    /**
     * Estimate credits required for an execution without running it.
     *
     * @param agentId - The UUID of the agent.
     * @param input - The input the agent would process.
     * @param opts - Additional options.
     * @param opts.workspace_id - The workspace to estimate for. Required when workspace
     *   is not inferrable from the API key.
     * @returns Cost estimate with min/max credit ranges.
     *
     * @example
     * const estimate = await admin.executions.estimate('agt_01...', {
     *   task: 'Process batch',
     * }, { workspace_id: 'ws_abc123' });
     * console.log(`Estimated: ${estimate.min_credits} - ${estimate.max_credits}`);
     */
    estimate(agentId: string, input: Record<string, unknown>, opts?: {
        workspace_id?: string;
    } & RequestOptions): Promise<ExecutionEstimate>;
    /**
     * List agent executions.
     *
     * @param opts - Optional filtering and request options.
     * @param opts.workspace_id - Filter to a specific workspace. Required when workspace
     *   is not inferrable from the API key.
     * @returns Array of execution records.
     *
     * @example
     * const executions = await admin.executions.list({ workspace_id: 'ws_abc123' });
     */
    list(opts?: {
        workspace_id?: string;
    } & RequestOptions): Promise<Execution[]>;
    /**
     * Get a single execution by ID.
     *
     * @param id - Execution UUID.
     * @param options - Optional request options.
     * @returns The execution record.
     *
     * @example
     * const exec = await admin.executions.get('exec_01...');
     * console.log(exec.status, exec.total_tokens);
     */
    get(id: string, options?: RequestOptions): Promise<Execution>;
    /**
     * Stream execution events via Server-Sent Events.
     * Returns an async iterator of typed execution events.
     *
     * @param id - Execution UUID to stream.
     * @param options - Optional request and stream options.
     * @returns Async iterator of ExecutionEvent objects.
     *
     * @example
     * const stream = await admin.executions.stream(exec.id);
     * for await (const event of stream) {
     *   if (event.type === 'token_delta') process.stdout.write(event.data.content);
     *   if (event.type === 'done') console.log('Complete');
     * }
     */
    stream(id: string, options?: RequestOptions & StreamOptions): Promise<AsyncIterableIterator<ExecutionEvent>>;
    /**
     * Approve a pending human-in-the-loop tool call.
     *
     * @param id - Execution UUID awaiting approval.
     * @param options - Optional request options.
     * @returns The updated execution record.
     *
     * @example
     * await admin.executions.approve('exec_01...');
     */
    approve(id: string, options?: RequestOptions): Promise<Execution>;
    /**
     * Deny a pending human-in-the-loop tool call.
     *
     * @param id - Execution UUID awaiting approval.
     * @param reason - Human-readable reason for rejection.
     * @param options - Optional request options.
     * @returns The updated execution record.
     *
     * @example
     * await admin.executions.deny('exec_01...', 'Not authorized to send emails');
     */
    deny(id: string, reason: string, options?: RequestOptions): Promise<Execution>;
    /**
     * Cancel an in-progress execution.
     *
     * @param id - Execution UUID to cancel.
     * @param options - Optional request options.
     * @returns The updated execution record with `cancelled` status.
     *
     * @example
     * await admin.executions.cancel('exec_01...');
     */
    cancel(id: string, options?: RequestOptions): Promise<Execution>;
    /**
     * List child executions spawned by a parent execution (multi-agent delegation).
     *
     * @param id - Parent execution UUID.
     * @param options - Optional request options.
     * @returns Array of child execution records.
     *
     * @example
     * const children = await admin.executions.children('exec_01...');
     */
    children(id: string, options?: RequestOptions): Promise<Execution[]>;
    /**
     * Get the full execution tree for a root execution.
     * Includes all nested child executions and their statuses.
     *
     * @param id - Root execution UUID.
     * @param options - Optional request options.
     * @returns Hierarchical execution tree structure.
     *
     * @example
     * const tree = await admin.executions.tree('exec_01...');
     */
    tree(id: string, options?: RequestOptions): Promise<ExecutionTreeNode>;
};
//# sourceMappingURL=executions.d.ts.map