Skip to main content

Execute an agent

POST 

/agents/:agent_id/execute

Runs an agent: retrieves fragments for the retrieval placeholders from the pipeline named in x-pipeline-id, inserts the input values and the fragment text into the prompt template, and sends the messages to the LLM named in x-llm-id. The stream field selects the response format: newline-delimited JSON (NDJSON) by default, server-sent events with "sse" or plain text with false. With tracing set to true, Foundation4 records a trace for 60 minutes and returns the trace identifier in the x-foundation4ai-tracing-id response header.

Permissions. Execute on the agent, the pipeline and the LLM.

Agents and prompt templates describes execution, and LLMs describes the requirements on the model server and the response formats.

Request​

Responses​

The answer in the format that stream selects: NDJSON lines of ApiLlmResponse objects, server-sent events with the same objects as data, or the complete answer as plain text. With tracing set to true, the x-foundation4ai-tracing-id header holds the trace identifier.

Response Headers
    x-foundation4ai-tracing-id

    The identifier of the execution trace, present when the request sets tracing to true. GET /tracing/{execution_id} returns the trace.