cast invoke
Send a prompt to a deployed agent and get a response.Usage
Arguments
| Argument | Description | Required |
|---|---|---|
slug | Agent slug | Yes |
prompt | The prompt to send | No (can use -i instead) |
Options
| Option | Description |
|---|---|
-i, --input <file> | Read prompt from a file |
-s, --session <id> | Session ID for conversation continuity (reuses sandbox) |
Examples
Basic invocation
Read prompt from a file
Multi-turn conversations
Use the-s, --session option to maintain conversation history:
What Happens During Invoke
- Request received — Your prompt is sent to the Castari API
- Sandbox activated — A sandbox is spun up (or reused if session specified)
- Agent runs — Your agent code executes with the prompt as input
- Response collected — Output is captured and returned to you
- Cleanup — Without a session, sandbox is destroyed. With a session, it persists.
Errors
| Error | Cause | Fix |
|---|---|---|
Agent not found | Invalid slug | Check cast agents list for correct slug |
Agent not active | Agent not deployed | Run cast deploy first |
Timeout exceeded | Agent took too long | Optimize your agent |
Invocation failed | Agent error | Check agent logs in dashboard |
See Also
- cast deploy — Deploy an agent
- SDK invoke — Invoke programmatically