<!-- TIER:1 -->
Configuring AI Agents
An AI agent is an LLM-powered import step that processes records through an AI model instead of writing them to an external system. Records flow in, the model processes them according to instructions, and structured output flows back into the pipeline.
AI agents handle four concerns:
- Prompt design -- the system instruction that defines the model's behavior, goals, and constraints (up to 50 KB). The prompt receives each record as context and must produce output that downstream steps can consume
- Structured output -- output format forces the model to return data conforming to a JSON Schema, enabling reliable field extraction for mapping. returns free-form responses. returns binary data (image generation)
- Tool use -- the model can call web search, MCP server tools, Celigo Tool resources, or image generation during processing. Tools extend the model's capabilities beyond its training data
- Response mapping -- extract fields from the model's response back into the record for downstream steps. Configured on the flow's entry, but planned when building the agent. The response is available via . Response mapping uses Transformation 1.0 syntax (extract/generate pairs)
AI agents do not require a
unless using BYOK (bring your own key). Without one, platform-managed credentials are used.
Used across flows, APIs, and tools.
Two Types of AI Import
AI Agent Imports
Invoke an LLM for classification, extraction, summarization, translation, or generation. Two providers:
- OpenAI () -- GPT models via the OpenAI Responses API. Supports reasoning effort control, structured JSON output, web search, MCP tools, Celigo Tools, and image generation.
- Gemini () -- Google Gemini models via LiteLLM proxy. Supports thinking config, Google Search grounding, URL context, file search, MCP tools, and Celigo Tools.
Guardrail Imports
Safety and compliance checks applied to data flowing through integrations. Three sub-types:
- ai_agent -- uses an AI model to evaluate data against custom instructions (reuses the same config as AI Agent imports)
- pii -- detects and optionally masks personally identifiable information (email, SSN, credit card, etc.)
- moderation -- checks content against moderation categories (hate speech, violence, harassment, etc.)
Guardrails do not require a
unless using BYOK for the
sub-type.
AI agent vs guardrail: pick by what the LLM produces. A guardrail renders a fixed
verdict (
plus reasoning) that the parent's routing branches on -- reach for it when the user says "verify / check / validate / flag / screen". An AI agent step does
work whose output flows onward as data -- reach for it when the user says "classify / extract / generate / summarize / decide". Guardrails flag; they never block on their own -- the parent flow/API/tool decides what happens to flagged records (see
configuring-guardrails).
Quick Reference
Adaptor Decision Matrix
| You need... | Use adaptorType | Config block | Read schema |
|---|
| LLM classification, extraction, generation | | | aiagent.yml |
| PII detection or masking | | | guardrail.yml |
| Content moderation | | | guardrail.yml |
| AI-based custom validation | with guardrail.type: "ai_agent"
| | guardrail.yml + aiagent.yml |
is
case-sensitive:
, not
.
Provider Decision Matrix
| Provider | Config path | Instructions field | Models | Tool types |
|---|
| OpenAI | | | , , , , , | , , , |
| Gemini | | litellm._overrides.gemini.systemInstruction
| , | , , , , |
Minimum Required Fields
AiAgentImport: ,
adaptorType: "AiAgentImport"
,
, and provider config (
or
). Instructions and model are required within the provider block.
GuardrailImport: ,
adaptorType: "GuardrailImport"
,
, and the sub-type config (
,
, or
).
Schema Index
All schemas are in references/schemas/:
- Base fields (all imports): request.yml
- Response shape: response.yml
- AI agent config: aiagent.yml -- provider, model, instructions, reasoning, temperature, output format, tools
- Guardrail config: guardrail.yml -- PII entities, moderation categories, AI-based validation, confidence threshold
Input Fields
An AI agent step receives an in-flight record and maps parts of it into one of four input fields. The mapping destination dropdown shows exactly these four -- no more:
| Field | Type | Purpose |
|---|
| string | Free text for the model to reason over. The most common input |
| object or array | The full structured record (or part of it) as JSON. Use when the model needs to see multiple fields together |
| array of | File references. Text files are sent inline; images and PDFs are converted to a pre-signed URL the model fetches; other file types error |
| string | Stable per-conversation identifier that retains and replays history across runs (see Conversation History) |
If no input mapping is defined, the agent receives the un-mapped in-flight record as
by default.
Output Formats
The output format determines both what the model returns and which response variable carries it into response mapping:
| Format | Response variable | Use for |
|---|
| | Free-form text -- summaries, generated content, classifications parsed downstream |
| | Structured JSON conforming to a schema. Use when downstream steps need consistent fields. With , non-conforming outputs fail rather than pass through |
| | Binary content stored in Celigo blob storage that downstream steps fetch or forward. Used for image generation |
The response-mapping dropdown only shows the response field the chosen output format can produce.
Related Skills
- configuring-imports > AI Imports -- how AI agents fit within the broader import category
- configuring-connections > Quick Reference -- MCP connections for tool use, HTTP connections for BYOK
- building-flows > How to Build a Flow -- wiring AI agents into flow pipelines
- building-tools > Tool Concepts -- building Celigo Tools that AI agents can invoke
- writing-mappings > Response Mapping Reference -- extracting fields from AI responses
- troubleshooting-flows > Diagnostic Workflow -- diagnosing AI agent failures
- writing-handlebars > Quick Reference -- dynamic expressions in AI prompts and field values
<!-- TIER:2 -->
How to Build an AI Agent
1. Determine the task
What should the AI model do with each record? Common patterns: classification (sentiment, routing), extraction (invoice parsing, address normalization), validation (business rules), generation (translations, summaries), enrichment (web search augmentation). The task determines the provider, model, output format, and whether tools are needed.
2. Check for existing patterns
bash
# Search for existing AI agents in the account
celigo ai-agents list
# Search across the entire account
celigo account search "ai agent"
celigo account search "<task keyword>"
3. Choose the provider and model
Use OpenAI for most tasks -- it has broader tool support and reasoning controls. Use Gemini when you need Google Search grounding, URL context retrieval, or file search.
Within each provider, choose the model based on the task complexity:
- Simple tasks (classification, routing): use smaller models (, , , )
- Complex tasks (multi-step reasoning, extraction): use larger models (, , )
- Cost-sensitive: smaller models process faster and cost less
4. Write the instructions
The system instruction is the most important configuration. Be specific about the task, expected input shape, and desired output. Include examples for complex tasks. Set constraints for edge cases (empty fields, invalid data). Keep instructions focused on a single responsibility per agent.
5. Configure the output format
Three options:
- -- forces structured JSON output conforming to a schema. Use this whenever downstream steps need to map specific fields from the response. Define the schema in (OpenAI) or
responseFormat.jsonSchema
(Gemini)
- -- free-form text response. Use for summarization, translation, or when the entire response is one field
- -- binary output (image generation use cases)
For
, set
if you need guaranteed schema conformance (slightly higher latency).
6. Tune parameters
- (OpenAI) or
thinkingConfig.thinkingLevel
(Gemini) -- controls depth of reasoning. Use for most tasks; for simple classification; for complex analysis
- -- for deterministic output (data extraction, classification); for creative generation
- / -- set based on expected response size. for short classifications; for detailed extractions; for long-form generation
7. Add tools (if needed)
Tools extend what the model can do during processing:
- (OpenAI) / (Gemini) -- search the web for current information to enrich records
- -- connect to an MCP server for external tool calls. Requires an MCP connection (). Optionally restrict with
- -- invoke a Celigo Tool resource. Reference via . Supports per-agent
- (OpenAI) -- generate images from text descriptions
- (Gemini) -- fetch and process URL content
- (Gemini) -- search uploaded files
8. Configure BYOK (optional)
By default, AI agents use platform-managed credentials. To use your own API key, create an HTTP connection with your provider's API key and set
on the import, or use
celigo ai-agents replace-connection <agentId> <connectionId>
.
9. Build the JSON
Read the schema files from the
Schema Index. Start with
request.yml for base fields, then
aiagent.yml for the provider configuration block.
Celigo AI vs BYOK
Cutting across both providers is a second decision: run the agent on Celigo AI (platform-managed credentials) or BYOK (bring your own key).
- Celigo AI -- no API key to manage. The trade is restriction: model choice is limited to Celigo's curated per-provider list (a subset of the GPT-5 and GPT-4.1 families on OpenAI; the Gemini 2.5 family on Gemini), and usage counts against the account's monthly AI token quota
- BYOK -- the agent uses your own API key (configured on a connection; see step 8 above). Any model the provider supports is available -- new releases, fine-tuned models, models off Celigo's curated list -- and quota and rate limiting move to your provider account
Default to Celigo AI for prototyping, low-volume agents, and agents happy with the curated model list. Reach for BYOK when you need a model that isn't on the list, when volume would exceed the monthly token quota, or when you want costs to land on your existing AI vendor billing.
Switching between Celigo AI and BYOK -- or changing the model -- can drop configuration that no longer applies:
is BYOK-only,
applies only to reasoning-capable models, and image modalities apply only to image-capable Gemini models. It is not a one-knob change.
Conversation History
By default, AI agent steps are stateless -- each record is its own conversation and the agent has no memory of previous records. This keeps behavior reproducible and cost predictable.
To make an agent
stateful, map a stable per-conversation identifier into its
input field -- a Slack thread ID, session UUID, customer ID, or ticket number, whatever is unique per conversation. Celigo retains the conversation history for that identifier and replays it on subsequent calls, so the agent sees prior turns. Mapping
, for example, makes every reply in a Slack thread aware of the earlier messages.
The identifier is scoped per user and per agent: the same string used by two different agents is two separate conversations, and the same agent used by two different users is two separate conversations. The retained history is not accessible through public APIs or the UI -- it exists for the model to read, not for users to browse -- and idle conversations age out via a TTL that resets on each update.
Capability Check Before Building
Before building an agent, walk through each action the requirement says the agent should perform and confirm each one maps to a capability the agent will actually have at runtime. The goal is to surface gaps early, not to refuse capabilities.
Capabilities come from three places:
- Native to the chosen model -- OpenAI's and ; Gemini's , , , and image-modality output
- Tools wired into the agent -- tools and Celigo Tools
- Downstream steps in the parent -- rendering output, writing to a destination, notifying a recipient (same shape whether the parent is a flow, API endpoint, or Tool)
For each action, ask which of the three covers it; if none do, that is a gap to raise before building. A common example is "generate a PDF invoice": no provider ships PDF rendering as a native capability, so the right shape is the agent emitting structured invoice content (
output) with a downstream step or Celigo Tool rendering the PDF. Equally, don't enable capabilities the requirement didn't ask for -- "classify support tickets" needs text classification (native), not
"just in case."
How to Build a Guardrail
1. Choose the guardrail type
- -- detect (and optionally mask) personally identifiable information. Configure which entity types to scan for in . Note: returns the redacted payload under a response field -- downstream steps only see it if you author a response-mapping write-back (see configuring-guardrails > PII: mask vs flag)
- -- check content against harmful categories. Configure which categories in
guardrail.moderation.categories
- -- custom AI-powered validation using the same LLM configuration as AI Agent imports
2. Set the confidence threshold
guardrail.confidenceThreshold
(0 to 1, default 0.7) controls sensitivity. Lower values catch more potential issues but increase false positives.
3. Build the JSON
Read
guardrail.yml for all configuration options. For the
sub-type, also read
aiagent.yml.
CLI Commands
bash
# CRUD -- AI Agents
celigo ai-agents list
celigo ai-agents get <id>
celigo ai-agents create < agent.json
celigo ai-agents update <id> < agent.json
celigo ai-agents set <id> key=value [key2=value2 ...]
celigo ai-agents delete <id> [-y]
# Invoke (test without creating a job)
echo '[{"text":"classify this"}]' | celigo ai-agents invoke <id>
# Clone and connection management
celigo ai-agents clone <id>
celigo ai-agents replace-connection <id> <newConnectionId>
# Debug
celigo ai-agents enable-debug <id> [--duration <minutes>]
celigo ai-agents disable-debug <id>
# CRUD -- Guardrails
celigo guardrails list
celigo guardrails get <id>
celigo guardrails create < guardrail.json
celigo guardrails update <id> < guardrail.json
celigo guardrails set <id> key=value [key2=value2 ...]
celigo guardrails delete <id> [-y]
# Invoke (test without creating a job)
echo '[{"text":"check this content"}]' | celigo guardrails invoke <id>
# Clone and connection management
celigo guardrails clone <id>
celigo guardrails replace-connection <id> <newConnectionId>
# Debug
celigo guardrails enable-debug <id> [--duration <minutes>]
celigo guardrails disable-debug <id>
# Discovery
celigo account search "<keyword>"
celigo templates marketplace
<!-- TIER:3 -->
Pre-Submit Checklist
Required (AI Agent)
Required (Guardrail)
Cross-resource consistency
Gotchas
- PUT erases omitted fields. Always GET first, modify, then PUT. The command handles this.
- OpenAI and Gemini use different config paths. OpenAI instructions are at
aiAgent.openai.instructions
; Gemini instructions are at aiAgent.litellm._overrides.gemini.systemInstruction
. Using the wrong path silently produces an agent with no instructions.
- Gemini model IDs require the prefix. Use , not . Without the prefix, LiteLLM cannot route to the correct provider.
- output without a schema definition returns unpredictable JSON. Always define when using output format.
- Response mapping is on the flow, not the agent. AI responses are available via in the flow's response mapping. Putting mapping config on the agent itself has no effect.
- MCP tool connections must be type . Regular HTTP connections cannot be used as even if they point to an MCP server URL.
- defaults to 1000. For complex extractions or long-form generation, increase this or the response will be truncated silently.
- Off-list models are silently swapped without BYOK. Selecting a model that isn't on Celigo's curated list when no BYOK connection is wired up makes the engine substitute the provider's default and surface a warning. Model-gated parameters the resolved model doesn't accept are also stripped (e.g., on a model, on a non-thinking Gemini model). Read the returned warnings rather than assuming your requested model and parameters ran.
- Unmapped inputs default to . With no input mapping defined, the entire in-flight record is passed to the agent as . Convenient for prototypes, but map , , or explicitly for precise control over what the model sees.
Common Errors
| Error | Cause | Fix |
|---|
| 422 | Wrong case | Use or exactly |
| Truncated AI response | too low | Increase to match expected response size |
| Empty or nonsensical output | Missing or vague instructions | Write specific instructions with expected input/output format |
| Wrong connection type | Use an MCP connection, not HTTP |
| Tool resource deleted or wrong ID | Verify tool exists with |
| Guardrail flags everything | too low | Increase threshold (e.g., 0.7 to 0.9) |
| Guardrail misses obvious PII | Missing entity types | Add all relevant entity types to |