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.Parameters
Name of the agent to invoke.
Input data matching the agent’s input schema.
Execution context including identity, metadata, and other contextual information.
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.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.Response
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
Passstream: true to receive incremental results as the agent generates output.
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.