Skip to main content

Invocations

An invocation is a single request-response cycle with an agent.

What is an Invocation?

When you run:
You create an invocation — a record of:
  • The prompt you sent
  • The response you received
  • Tokens used and cost
  • Execution time
  • Status (completed, failed)

Invocation Flow

  1. Request — You send a prompt via CLI, SDK, or API
  2. Routing — Castari routes to your agent’s sandbox
  3. Execution — Agent processes prompt, uses tools, generates response
  4. Response — Output captured and returned to you
  5. Tracking — Tokens, cost, and duration recorded

Input and Output

Input

Your prompt is passed to the agent via stdin:

Output

Agent response is written to stdout:
Only stdout is captured as the response. stderr is logged but not returned.

Invocation Result

Every invocation returns:

Statuses

Timeouts

Default timeout is 120 seconds (2 minutes). Maximum timeout: 600 seconds (10 minutes). Timeouts result in a failed status with an appropriate error message.

Cost Tracking

Costs are calculated based on:
  • Input tokens — Prompt + system instructions
  • Output tokens — Agent’s response
  • Model — Claude pricing tiers
View your usage:

Concurrency

Multiple invocations can run in parallel:
Each gets its own isolated sandbox.

Error Handling

In CLI

In SDK

See Also

cast invoke

CLI reference

Agents API

SDK reference

Debugging

Troubleshooting tips