Skip to main content

Basic generation

Use ctx.llm.generate() for text completion:

Model Resolution

You can specify models in three ways:
Resolution order (first match wins):
  1. Fully qualified per-call (provider:model) - use directly
  2. Bare per-call + decorator provider - resolve
  3. No per-call model + decorator default - use default
  4. Nothing configured - error

Structured Output

Use ctx.llm.generate_object() for JSON Schema-constrained output:

Response Fields

The LlmResponse object contains:

Error Handling

LLM errors raise LlmError:

Advanced Options

ctx.llm reference

Full API reference for LLM generation.

How agents work

Why the SDK uses host capabilities instead of direct imports.