Skip to main content
Connic
Build

Agent YAML

Agent YAML fields, plus the syntax for prompts, tools, and conditional configuration.

Last updated

Configuration fields

FieldTypeStatusDescription
versionstringRequiredConfiguration schema version. Must be '1.0'.
namestringRequiredUnique agent identifier. Use lowercase letters, numbers, and hyphens.
typestringOptionalAgent type: llm, sequential, or tool. See Agent Types.Default: llm
descriptionstringRequiredHuman-readable description of what the agent does.
modelstringOptionalPrimary AI model. Required for LLM agents. See Models and Providers.
fallback_modelstringOptionalFallback used when the primary model request fails before returning output.
system_promptstringOptionalInstructions for LLM agents. Use YAML's pipe character for multiple lines.
toolslistOptionalTools loaded into an LLM agent context. Supports strings, condition mappings, and wildcard patterns. See Conditional Tools. Maximum 100 per agent.Default: []
discoverable_toolslistOptionalTools indexed for on-demand discovery instead of loaded up front. Uses the same strings, conditions, and wildcards as tools. See Discoverable Tools.Default: []
agentsstring[]OptionalAgent names to execute in sequence. Required for sequential agents.Default: []
tool_namestringOptionalCustom tool executed directly by a tool agent. Use its exact dotted module path. Predefined and api: tools are not allowed.
max_concurrent_runsintegerOptionalMaximum simultaneous runs, capped by the subscription plan. See Runtime Controls.Default: 1
temperaturenumberOptionalControls randomness in LLM output. Lower values are more deterministic.Default: 1
reasoning_effortstringOptionalUse auto for model-managed behavior. Supported overrides vary by model; see the Connic model catalog or your BYOK provider's documentation.Default: auto
reasoning_budgetintegerOptionalRaw reasoning-token budget for models that accept an explicit budget. Use reasoning_effort for models with named effort levels.
retry_optionsobjectOptionalRetries at the failing operation boundary. LLM requests are retried without replaying the agent; tool and sequential agents retain operation-level retries.
attemptsintegerOptionalMaximum attempts for the model being retried or for a non-LLM operation, including the first. With a fallback, the primary is tried once and this budget applies to the fallback. Maximum 10.Default: 3
initial_delaynumberOptionalInitial backoff in seconds. Model requests use capped exponential backoff with jitter unless the provider sends Retry-After.Default: 10
max_delaynumberOptionalMaximum generated backoff in seconds. Provider Retry-After values remain subject to the overall timeout. Maximum 300.Default: 30
rerun_middlewarebooleanOptionalRe-run before middleware for operation retries on tool and sequential agents. It has no effect on LLM agents.Default: false
timeoutintegerOptionalMaximum execution time in seconds. Minimum five seconds and always capped by the subscription limit.
max_iterationsintegerOptionalMaximum LLM loop iterations per run. Prevents infinite loops and excessive resource use.Default: 100
guardrailsobjectOptionalInput and output safety rules for LLM agents. See Guardrails.
inputobject[]OptionalRules applied to raw input before middleware and agent execution.
outputobject[]OptionalRules applied to the response before it is returned.
run_after_on_blockbooleanOptionalWhether after middleware runs when an input rule blocks the request.Default: true
typestringRequiredGuardrail type: prompt_injection, pii, moderation, topic_restriction, regex, pii_leakage, system_prompt_leakage, relevance, data_exfiltration, or custom.
modestringOptionalblock, warn, or redact. Redaction is only supported for pii and pii_leakage.Default: block
namestringOptionalGuardrail module name. Required when type is custom.
configobjectOptionalPer-rule options including messages, fail_run, entities, patterns, provider, sensitivity, and model.
rejection_messagestringOptionalMessage returned when a rule blocks. Falls back to off_topic_message.
off_topic_messagestringOptionalMessage for topic_restriction blocks and fallback for rejection_message.
fail_runbooleanOptionalWhen true, a block marks the run failed. Otherwise it returns a completed response with the rejection message.Default: false
output_schemastringOptionalJSON Schema filename from schemas/. Constrains LLM output to the schema. See Output Schema.
databaseobjectOptionalDatabase tool access controls. Omit for unrestricted database access.
collectionsstring[] | objectOptionalRestrict access to named collections. The mapping form supports per-collection prevent_delete and prevent_write overrides.
prevent_deletebooleanOptionalBlock db_delete. A collection override can replace this value.Default: false
prevent_writebooleanOptionalBlock db_insert, db_update, and db_upsert. A collection override can replace this value.Default: false
retrievalobjectOptionalRetrieval tool access controls. Omit for unrestricted retrieval access.
namespacesstring[] | objectOptionalRestrict access to named namespaces. The mapping form supports per-namespace prevent_delete and prevent_write overrides.
prevent_deletebooleanOptionalBlock retrieval_delete. A namespace override can replace this value.Default: false
prevent_writebooleanOptionalBlock retrieval_store. A namespace override can replace this value.Default: false
mcp_serversobject[]OptionalExternal MCP servers. Maximum 50 per agent. See Use MCP Servers.
namestringRequiredMCP server identifier.
urlstringRequiredMCP server endpoint URL.
toolsstring[]OptionalOptional filter of tools to load. Omit to use every server tool.
headersobjectOptionalAuthentication headers. Supports variable interpolation with ${VAR} and per-run interpolation with ${context.*}.
discoverablebooleanOptionalIndex tools from this server for on-demand discovery rather than loading them up front.Default: false
bridgestringOptionalBridge ID for routing to a private server. Supports ${VAR} interpolation.
concurrencyobjectOptionalOne active run per resolved key. Not supported on sequential agents. See Concurrency Rules.
keystringRequiredDot path used to extract the key from the trigger payload.
on_conflictstringOptionalqueue waits for the active run; drop cancels the new run.Default: queue
approvalobjectOptionalHuman approval for selected tools. See Approvals.
toolslistRequiredTool references that require approval. A mapping value can condition approval with param.* and context.* expressions.
timeoutintegerOptionalSeconds to wait for a decision. Range: 30–604800.Default: 3600
messagestringOptionalCustom message shown to the reviewer.
on_rejectionstringOptionalfail terminates the run; continue returns a rejection message to the LLM so it can adapt.Default: fail
sessionobjectOptionalPersistent conversation history keyed by a resolved value. See Persistent Sessions.
keystringRequiredDot path beginning with context. or input. that resolves the session ID.
ttlintegerOptionalSession expiry in seconds. Minimum 60; without it, sessions do not expire.
context_compressionobjectOptionalMid-run compression for long LLM sessions. Omit to keep compression off.
enabledbooleanOptionalEnable compression when the block is present.Default: true
modelstringOptionalOptional model used only for compression summaries. Defaults to the agent model.
max_prompt_tokensintegerOptionalPrompt-token threshold that can trigger compression before a provider context-window error.
keep_recent_messagesintegerOptionalRecent messages kept verbatim when compression runs.Default: 8
session_historyobjectOptionalOptional stored-history compaction between runs. Omit to keep it off.
intervalintegerOptionalCompact older stored history after this many runs.
keep_recent_runsintegerOptionalRecent runs left unsummarized during stored-history compaction.Default: 1
Required fields by type

All agents: version, name, and description

LLM: + model and system_prompt · Sequential: + agents · Tool: + tool_name

Writing system prompts

agents/agent.yaml
system_prompt: |
  This is a multi-line system prompt.

  You can write multiple paragraphs here.
  The pipe character (|) preserves newlines.

  Use this for complex instructions.

Referencing tools

agents/agent.yaml
# Reference tools by exact module path under tools/
tools:
  - search.web_search            # tools/search.py -> web_search()
  - billing.calculator.add       # tools/billing/calculator.py -> add()
  - email.send_notification      # tools/email.py -> send_notification()
  - billing.*                    # all public functions in tools/billing.py
  - support.search_*             # functions starting with search_ in tools/support.py

Tools are Python functions in tools/. Top-level modules use references like calculator.add; nested modules use their full dotted path. See Write Custom Tools.

A wildcard * matches a sequence of characters. billing.* includes every public function in tools/billing.py, while support.search_* includes matching functions. Wildcards also work with API spec tools. Deployment fails if a wildcard matches nothing.

Conditional tools

Use a mapping from tool reference to expression to make a tool available only when the expression is true. A false condition removes the tool for that request.

agents/agent.yaml
# Conditional tools use Python expression syntax.
tools:
  - calculator.add
  - calculator.multiply: context.multiply_allowed
  - web_search: input.search_enabled
  - admin.dangerous_tool: input.role == 'admin' or context.admin
  - premium.tool: input.tier == 'pro' and context.feature_on
  - optional.tool: not context.disabled
Expression Syntax

Python-like syntax: and, or, not; comparisons == != > < >= <=; membership in, not in; parentheses for grouping; string literals in single or double quotes. Reach into nested objects with dot-paths like context.user.role. A bare path like context.active is a truthy check: it passes when the value is set and not empty, zero, or false. Missing fields make the surrounding predicate fail rather than raising.

context.<key>
Values from the run context, including middleware values and Connic-provided run metadata. Nested paths such as context.user.role are supported.
input.<key>
Values from the connector JSON payload. For non-JSON payloads, every input.* check is false.

Set context in middleware

middleware/assistant.py
async def before(content: dict, context: dict) -> dict:
    # Set context values that tool conditions can check.
    payload = context.get("payload", {})
    context["multiply_allowed"] = True
    context["admin"] = payload.get("role") == "admin"
    return content
Expression validation

Deployment rejects invalid Python expression syntax. At run time, unsupported expression forms and unknown roots evaluate to false. A bare accessor such as context.foo is a truthy check.

Discoverable tools

Loading a large tool set into the model context increases token usage and can reduce accuracy. Put infrequently used tools in discoverable_tools so the agent can find them on demand with a natural-language search. The list supports the same strings, wildcards, and conditions as tools.

agents/multi-purpose-assistant.yaml
version: "1.0"

name: multi-purpose-assistant
type: llm
model: connic/gpt-5.6-terra
description: "Assistant that discovers tools on demand to keep context lean"
system_prompt: |
  You are a multi-purpose assistant with access to many tools.

# Always available in the LLM context
tools:
  - math.calculator.add
  - math.calculator.multiply

# Indexed for on-demand discovery at runtime
discoverable_tools:
  - math.calculator.calculate_tax
  - orders.*
  - social.twitter.post_tweet
  - assistant_tools.*

Discoverable MCP servers

Mark an entire MCP server as discoverable to index its tools instead of loading them up front.

agents/agent.yaml
mcp_servers:
  - name: large-toolset
    url: https://mcp.example.com/tools
    discoverable: true   # tools indexed for search, not loaded upfront
No overlap allowed

A function cannot resolve from both tools and discoverable_tools. Deployment fails when the lists overlap.