v0.2.0· Apache 2.0

Search docs...

corail/configuration

4 min read

Configuration

Corail is configured via CORAIL_* environment variables. CLI flags override env vars when using the CLI entry point.

Environment variables

All variables use the CORAIL_ prefix and are defined in corail/config.py using pydantic-settings.

VariableDefaultDescription
CORAIL_CHANNELrestI/O channel: rest
CORAIL_STRATEGYsimpleExecution strategy: simple
CORAIL_MODEL_TYPEstubLLM provider: stub, ollama, openai, anthropic, google-ai, vertex-ai, bedrock. See LLM Providers.
CORAIL_MODEL_IDstub-echoModel identifier (e.g., gpt-4, claude-sonnet-4-20250514, gemini-2.5-flash, qwen3.5:35b)
CORAIL_SYSTEM_PROMPTYou are a helpful assistant.System prompt text
CORAIL_STORAGEmemoryStorage backend: memory, postgresql
CORAIL_DATABASE_URL(empty)PostgreSQL connection string (required when storage=postgresql)
CORAIL_PORT8000HTTP server port
CORAIL_HOST0.0.0.0HTTP server bind address
CORAIL_ENVdevEnvironment name
CORAIL_LOG_LEVELINFOLog level
CORAIL_LOG_FORMATjsonLog format
CORAIL_TOOLS(empty)JSON array of tool configs (injected by operator from Tool CRDs)
CORAIL_KNOWLEDGE_BASES(empty)JSON array of KB configs (injected by operator from Agent CRD knowledgeBases)
CORAIL_BACKGROUND_MODEL(empty)provider:model_id URI for cheap background work — memory extraction, follow-up suggestions, auto titles. When empty, background tasks reuse the main chat model. See Background model.
CORAIL_OLLAMA_TIMEOUT300HTTP timeout (seconds) for calls to Ollama. Bump for large local models on slow hardware.
CORAIL_OLLAMA_KEEP_ALIVE30mHow long Ollama keeps each model loaded after a request. Needs to be long enough to hold the chat model and the background model simultaneously, otherwise every turn pays a reload cost.
CORAIL_SUGGESTIONS_TIMEOUT15Hard deadline (seconds) for follow-up suggestion generation. Beyond this, the SSE stream closes without suggestions so proxies don't drop mid-chunk.
CORAIL_RECIF_GRPC_ADDRlocalhost:50051Recif gRPC control plane address
CORAIL_JWT_PUBLIC_KEY(empty)JWT public key for auth (optional, used with Istio trusted headers)

CORAIL_TOOLS format

Set automatically by the operator when the Agent CRD has spec.tools. Manual example:

[
  {
    "name": "weather",
    "type": "http",
    "endpoint": "https://api.weather.com/v1/{city}",
    "method": "GET",
    "parameters": [
      {"name": "city", "type": "string", "description": "City name", "required": true}
    ]
  },
  {
    "name": "kubectl",
    "type": "cli",
    "binary": "kubectl",
    "allowedCommands": ["get", "describe", "logs"],
    "timeout": 15,
    "parameters": [
      {"name": "command", "type": "string", "description": "Subcommand"}
    ]
  }
]

CORAIL_KNOWLEDGE_BASES format

Set automatically by the operator when the Agent CRD has spec.knowledgeBases. Each entry creates a search_{kb_slug} tool that the agent calls through its react loop when the question is relevant. Manual example:

[
  {
    "kb_id": "product-docs",
    "name": "product-docs",
    "description": "Documents and knowledge about product-docs",
    "connection_url": "postgresql://user:pass@host:5432/db",
    "embedding_provider": "ollama",
    "embedding_model": "nomic-embed-text"
  }
]

The description field helps the LLM decide when to call the search tool. If omitted, a default is generated from the KB name.

CLI flags

When using the CLI entry point (corail command), flags override environment variables:

corail \
  --channel rest \
  --strategy simple \
  --model-type ollama \
  --model-id qwen3.5:35b \
  --system-prompt "You are a marine biologist." \
  --storage postgresql \
  --port 8000

Available flags:

FlagEnv var equivalent
--channelCORAIL_CHANNEL
--strategyCORAIL_STRATEGY
--model-typeCORAIL_MODEL_TYPE
--model-idCORAIL_MODEL_ID
--system-promptCORAIL_SYSTEM_PROMPT
--storageCORAIL_STORAGE
--portCORAIL_PORT
--toolsCORAIL_TOOLS
--knowledge-basesCORAIL_KNOWLEDGE_BASES

Kubernetes configuration

In Kubernetes, the operator creates a ConfigMap from the Agent CRD spec and injects it into the Pod via envFrom. You do not set these variables manually -- they are derived from the Agent resource:

apiVersion: agents.recif.dev/v1
kind: Agent
metadata:
  name: my-agent
  namespace: team-default
spec:
  name: "My Agent"
  framework: adk
  strategy: simple          # -> CORAIL_STRATEGY
  channel: rest             # -> CORAIL_CHANNEL
  modelType: ollama         # -> CORAIL_MODEL_TYPE
  modelId: qwen3.5:35b     # -> CORAIL_MODEL_ID
  systemPrompt: "..."      # -> CORAIL_SYSTEM_PROMPT
  storage: postgresql       # -> CORAIL_STORAGE
  databaseUrl: "postgres://..." # -> CORAIL_DATABASE_URL

The operator generates a ConfigMap named {agent-name}-config containing:

CORAIL_CHANNEL=rest
CORAIL_STRATEGY=simple
CORAIL_MODEL_TYPE=ollama
CORAIL_MODEL_ID=qwen3.5:35b
CORAIL_SYSTEM_PROMPT=...
CORAIL_STORAGE=postgresql
CORAIL_DATABASE_URL=postgres://...