Skip to main content

runOneShotAgent

@nmi-agro/fdm-source


@nmi-agro/fdm-source / fdm-agents/src / runOneShotAgent

Function: runOneShotAgent()

runOneShotAgent(agent, input, context?, posthog?, timeoutMs?): Promise<OneShotAgentResult>

Defined in: fdm-agents/src/runners/one-shot.ts:30

Common runner for one-shot agent execution in fdm-agents.

Parameters

agent

BaseAgent

The agent instance to run.

input

string

The user input string.

context?

Record<string, any> = {}

Extra context to provide to the agent (e.g. fdm, principalId).

posthog?

Optional PostHog client and distinctId for tracking.

client

any

distinctId

string

timeoutMs?

number = ...

Maximum milliseconds to wait for the agent to complete (default: 20 minutes). Throws AgentTimeoutError on expiry.

Returns

Promise<OneShotAgentResult>

The final response and token usage from the agent.