Maniac Docs
API Reference

Agents

Agent runtime, Maniac app, and run helpers.

@maniac-ai/agents


Functions

runAgent()

runAgent<T>(specInput, query, options?): Promise<AgentResult<T>>

Defined in: src/agents/runner.ts:415

Type Parameters

T

T = string

Parameters

specInput

Agent

query

string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[]

options?

RunOptions = {}

Returns

Promise<AgentResult<T>>


runAgentStream()

runAgentStream<T>(spec, query, options?): AsyncGenerator<StreamEnvelope<T>, void, undefined>

Defined in: src/agents/runner.ts:525

Async-iterable run that yields a tagged StreamEnvelope for every trace event followed by the terminal { type: "result" } envelope.

Cancellation contract:

  • If the caller passes options.signal and aborts it, the underlying run is cancelled and an error trace event is emitted before the iterator returns.
  • If the consumer breaks the for await loop early (or calls return() on the iterator), the runner aborts the inner controller so any in-flight model call / tool / nested run sees the cancellation.

Type Parameters

T

T = string

Parameters

spec

Agent

query

string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[]

options?

RunOptions = {}

Returns

AsyncGenerator<StreamEnvelope<T>, void, undefined>

References

TracerFactory

Re-exports TracerFactory


ChatOptions

Re-exports ChatOptions


Maniac

Re-exports Maniac


CheckpointNotPendingError

Re-exports CheckpointNotPendingError


sealUnansweredToolCalls

Re-exports sealUnansweredToolCalls


BackgroundTaskInput

Re-exports BackgroundTaskInput


DispatcherOptions

Re-exports DispatcherOptions


BackgroundTaskDispatcher

Re-exports BackgroundTaskDispatcher


BackgroundStreamItem

Re-exports BackgroundStreamItem


StreamEnvelope

Re-exports StreamEnvelope


safeTailStart

Re-exports safeTailStart


LMSummarizingCompactorOptions

Re-exports LMSummarizingCompactorOptions


LMSummarizingCompactor

Re-exports LMSummarizingCompactor


BaseStepHook

Re-exports BaseStepHook


CallableStepHook

Re-exports CallableStepHook


runBeforeStep

Re-exports runBeforeStep


runShouldStop

Re-exports runShouldStop


runBeforeFinalize

Re-exports runBeforeFinalize


runAfterStep

Re-exports runAfterStep


hasAfterStep

Re-exports hasAfterStep


stepCountIs

Re-exports stepCountIs


tokensExceed

Re-exports tokensExceed


wallSecondsExceed

Re-exports wallSecondsExceed


responseMatches

Re-exports responseMatches


Continuation

Re-exports Continuation


PrepareStep

Re-exports PrepareStep


StepContext

Re-exports StepContext


StepDecision

Re-exports StepDecision


StepHook

Re-exports StepHook


StopWhen

Re-exports StopWhen


MemoryBlock

Re-exports MemoryBlock


MemoryFilterReportedBlock

Re-exports MemoryFilterReportedBlock


MemoryFilterSummary

Re-exports MemoryFilterSummary


PrefixDecomposition

Re-exports PrefixDecomposition


decompositionHasMemory

Re-exports decompositionHasMemory


parseMemoryPrefix

Re-exports parseMemoryPrefix


reassemblePrefix

Re-exports reassemblePrefix


parseKeepIds

Re-exports parseKeepIds


MemoryRelevanceFilterOptions

Re-exports MemoryRelevanceFilterOptions


MemoryRelevanceFilter

Re-exports MemoryRelevanceFilter


ObservationBuffer

Re-exports ObservationBuffer


ObservationBufferOptions

Re-exports ObservationBufferOptions


ObservationsProxy

Re-exports ObservationsProxy


ObservationsProxyOptions

Re-exports ObservationsProxyOptions


observe

Re-exports observe


formatTranscript

Re-exports formatTranscript


ObserveOptions

Re-exports ObserveOptions


reflect

Re-exports reflect


formatObservationLog

Re-exports formatObservationLog


ReflectOptions

Re-exports ReflectOptions


OBSERVER_SYSTEM_PROMPT

Re-exports OBSERVER_SYSTEM_PROMPT


REFLECTOR_SYSTEM_PROMPT

Re-exports REFLECTOR_SYSTEM_PROMPT


formatObservationInput

Re-exports formatObservationInput


formatReflectionInput

Re-exports formatReflectionInput


bindChatContext

Re-exports bindChatContext


chatTurnContext

Re-exports chatTurnContext


clearChatContext

Re-exports clearChatContext


getChatContext

Re-exports getChatContext


ChatTurnContext

Re-exports ChatTurnContext


WorkingMemoryRunner

Re-exports WorkingMemoryRunner


formatWorkingMemoryMessage

Re-exports formatWorkingMemoryMessage


updateWorkingMemory

Re-exports updateWorkingMemory


WorkingMemoryRunnerOptions

Re-exports WorkingMemoryRunnerOptions


StreamItem

Re-exports StreamItem


RunScope

Re-exports RunScope


RunContext

Re-exports RunContext


RunOptions

Re-exports RunOptions


getActiveRunContext

Re-exports getActiveRunContext


getActiveAbortSignal

Re-exports getActiveAbortSignal


setPlan

Re-exports setPlan


updatePlanEntry

Re-exports updatePlanEntry


InterruptedRunPartial

Re-exports InterruptedRunPartial


RunCancelledError

Re-exports RunCancelledError


RunInterruptedError

Re-exports RunInterruptedError


runNestedAgent

Re-exports runNestedAgent


runAgentResume

Re-exports runAgentResume


runAgentResumeStream

Re-exports runAgentResumeStream


TracerOptions

Re-exports TracerOptions


Tracer

Re-exports Tracer

On this page