Skip to main content

Basic Usage

Send a single request to an agent and receive a response. Invoke is best for stateless, one-shot tasks like summarization, classification, or data extraction.
import Reminix from "@reminix/sdk"

const client = new Reminix({ apiKey: "your-api-key" })

const response = await client.agents.invoke("my-agent", {
  input: { prompt: "Summarize this document" },
})

console.log(response.output)

Parameters

agentName
string
required
Name of the agent to invoke.
input
object
required
Input data matching the agent’s input schema.
context
object
Execution context including identity, metadata, and other contextual information.
stream
boolean
default:false
Enable streaming. When true, returns an async iterable of server-sent events instead of a single response.

With Context

Pass execution context to provide identity or metadata to the agent.
const response = await client.agents.invoke("my-agent", {
  input: { prompt: "Summarize this document" },
  context: { identity: "user-123" },
})

Idempotency

Use an idempotency key to safely retry requests without duplicate processing. If a request with the same key has already been processed, the original response is returned.
const response = await client.agents.invoke("my-agent", {
  input: { prompt: "Process this payment" },
}, {
  headers: { "Idempotency-Key": "payment-abc-123" },
})

Response

output
unknown
The agent’s response. The type depends on the agent’s output schema — a prompt agent returns a string, a task agent returns an object, etc.

Streaming

Pass stream: true to receive incremental results as the agent generates output.
const stream = await client.agents.invoke("my-agent", {
  input: { prompt: "Write a story" },
  stream: true,
})

for await (const event of stream) {
  if (event.type === "text_delta") {
    process.stdout.write(event.delta)
  }
}
See Streaming for all event types.

Next steps

chat()

Multi-turn conversations with persistent history.

Error Handling

Catch typed errors and add retries.

Tasks

The interaction pattern behind invoke().

Streaming

Event types and SSE format reference.