Interface AgencyCallbacks

Event callbacks registered on BaseAgentConfig.on. All handlers are fire-and-forget (return void); errors thrown inside them are swallowed to prevent disrupting the main run.

interface AgencyCallbacks {
    agentStart?: ((e) => void);
    agentEnd?: ((e) => void);
    handoff?: ((e) => void);
    toolCall?: ((e) => void);
    error?: ((e) => void);
    emergentForge?: ((e) => void);
    guardrailResult?: ((e) => void);
    limitReached?: ((e) => void);
    approvalRequested?: ((e) => void);
    approvalDecided?: ((e) => void);
    guardrailHitlOverride?: ((e) => void);
}

Properties

agentStart?: ((e) => void)

Called immediately before an agent starts.

Type declaration

    • (e): void
    • Parameters

      • e: AgentStartEvent

      Returns void

agentEnd?: ((e) => void)

Called after an agent produces its final output.

Type declaration

    • (e): void
    • Parameters

      • e: AgentEndEvent

      Returns void

handoff?: ((e) => void)

Called when control is handed off between agents.

Type declaration

    • (e): void
    • Parameters

      • e: HandoffEvent

      Returns void

toolCall?: ((e) => void)

Called when an agent invokes a tool.

Type declaration

    • (e): void
    • Parameters

      • e: ToolCallEvent

      Returns void

error?: ((e) => void)

Called when an unhandled error occurs inside an agent.

Type declaration

    • (e): void
    • Parameters

      • e: {
            agent: string;
            error: Error;
            timestamp: number;
        }
        • agent: string
        • error: Error
        • timestamp: number

      Returns void

emergentForge?: ((e) => void)

Called when the emergent subsystem forges a new agent.

Type declaration

    • (e): void
    • Parameters

      • e: ForgeEvent

      Returns void

guardrailResult?: ((e) => void)

Called after a guardrail evaluates an input or output.

Type declaration

    • (e): void
    • Parameters

      • e: GuardrailEvent

      Returns void

limitReached?: ((e) => void)

Called when a resource limit is reached.

Type declaration

    • (e): void
    • Parameters

      • e: LimitEvent

      Returns void

approvalRequested?: ((e) => void)

Called when an approval request is raised.

Type declaration

approvalDecided?: ((e) => void)

Called after an approval decision is resolved.

Type declaration

guardrailHitlOverride?: ((e) => void)

Called when a post-approval guardrail overrides an HITL approval. Fires after a tool call was approved but a guardrail detected a destructive pattern and vetoed the execution.

Type declaration

    • (e): void
    • Parameters

      • e: GuardrailHitlOverrideEvent

      Returns void