ByteChef LogoByteChef
AutomationWorkflowsAI

AI Agent

Configure the AI Agent component in a workflow by attaching a chat model, memory, retrieval, guardrails and tools to one node.

The AI Agent is a cluster root component: one workflow node that turns a chat model into an assistant that can hold a conversation and call tools. You configure it by attaching other components to its slots as cluster elements: a Model (required), and optionally Memory, RAG, Guardrails and Tools. Swapping a provider, a memory backend or a retrieval strategy means replacing one cluster element, not rewiring the workflow. Workflow builders use it for multi-turn assistants, answers grounded in your own documents, agents that act through ByteChef actions, and agents that call other agents.

The AI Agent on the canvas as an inline frame, with its Model, Memory, RAG, Guardrails and Tools slots and the attached elements


Reference: AI Agent Component

ComponentReference
AI AgentaiAgent/v1: actions chat (Chat) and streamChat (Chat (stream)), and the AI Agent tool element

The AI Agent tool element lets one agent attach another agent in its Tools slot and call it as a tool.


Creating an AI Agent

Step 1: Add the AI Agent node

  1. Open a workflow in the Workflow Editor.
  2. Click the + button on a canvas edge to open the Components menu.
  3. Search for AI Agent and click it. A node labelled AI Agent appears on the canvas.

Step 2: Choose where to edit the agent

The workflow editor shows cluster elements in one of two views. The toolbar button on the right side of the canvas switches between them, and your choice is remembered in your browser.

  • Inline view (the default; tooltip Show cluster elements in the editor dialog). The agent and its cluster elements are drawn on the workflow canvas inside a frame, with a handle for each slot. The frame header has a Manage AI Skills link, a Test agent button, and buttons to lock node movement, reset the layout and collapse the cluster elements. Clicking the agent opens its properties in the side panel.
  • Dialog view (tooltip Show cluster elements inline). Clicking the agent node opens it in a full-screen dialog.

In the dialog view the agent opens in one of two editors:

  • AI Agent Editor (the simple editor, the default). The left column, Configuration, has the Model selector, the Stream response switch, the Instructions to follow, User input and Attachments fields, and the Tools this agent can use section. The right column, Agent Playbook, has a Test Agent button for sending test prompts without leaving the editor.
  • Advanced editor. Click Advanced in the editor header. The agent and its cluster elements are drawn on a canvas, with one handle for each slot (Model, Memory, RAG, Guardrails, Tools). This is the only dialog editor that reaches the Memory, RAG and Guardrails slots.

Both editors change the same configuration, so switching loses nothing. The editor you used last is remembered in your browser for every AI Agent node.

The AI Agent Editor: Configuration on the left, Agent Playbook on the right

The advanced editor: the Model, Memory, RAG, Guardrails and Tools slots, with a model and two tools attached

Step 3: Attach a model (required)

In the Model field, click Select a model... and pick a provider, for example Anthropic, OpenAI or Ollama. Configure its connection and parameters in the panel that opens. The agent needs exactly one model before it can run.

Step 4: Write the prompts

  • Instructions to follow (systemPrompt): the system prompt that defines the agent's role, behavior and constraints.
  • User input (userPrompt, required): the message sent to the agent on each execution, usually a data pill from the trigger.
  • Attachments: file data pills to attach to the message. Only text and image files are supported, and only some models accept images.

Type $ in a field to insert data pills.

Step 5: Attach chat memory (optional)

Use the Memory handle on the inline frame or in the advanced editor, and pick one backend. Without chat memory, every execution starts a new conversation with no prior context. See Chat Memory Slot.

Step 6: Attach RAG (optional)

Use the RAG handle to attach one retrieval pipeline. See RAG Slot.

Step 7: Attach guardrails (optional)

Use the Guardrails handle to attach a Check For Violations parent (blocks the request or reply) or a Sanitize Text parent (masks matches in place), then attach detectors such as PII or Jailbreak inside it. An agent accepts at most one parent of each kind; put all detectors of one kind under the same parent. See Guardrails Slot.

Step 8: Attach tools (optional)

In Tools this agent can use, click Add Tool to expose a component action, a script, an MCP server or another AI Agent as a tool. The model sees each tool's name and description and decides which to call.

Every tool has optional Tool Name and Tool Description fields above its own properties. When left blank, the underlying operation's name and description are used. Set them when the default reads poorly to a model or when two tools are hard to tell apart. A tool name can have up to 64 characters: letters, digits, _ and -. Any other character, including a space, is rejected as you type.

A tool placed inside an Approval Gate Tool appears in a group marked requires approval, with its own Add Tool and Add Channel buttons. See Agent Utils Tools.

Step 9: Test the agent

In the Agent Playbook column (or with Test agent on the inline frame), click Test Agent and send sample prompts. Tool calls appear in the conversation, so you can check the wiring before you deploy the workflow.

The agent in the workflow definition

In the workflow JSON, the prompts are parameters of the AI Agent task, and the model, memory, RAG, guardrails and tools are stored under clusterElements. This support agent uses an OpenAI model and a Slack tool. The channel is fixed, and the model writes the message text through fromAi:

{
  "name": "aiAgent_1",
  "type": "aiAgent/v1/chat",
  "parameters": {
    "format": "SIMPLE",
    "systemPrompt": "You are a support assistant for Acme. Answer in two sentences or fewer. If the customer reports an outage, post a short summary to the on-call Slack channel before you reply.",
    "userPrompt": "${trigger_1.body.message}",
    "response": {
      "responseFormat": "TEXT"
    }
  },
  "clusterElements": {
    "model": {
      "name": "openAi_1",
      "type": "openAi/v1/model",
      "parameters": {
        "model": "gpt-4o-mini",
        "temperature": 0.2
      }
    },
    "tools": [
      {
        "name": "slack_1",
        "type": "slack/v1/sendChannelMessage",
        "parameters": {
          "channel": "C01234567",
          "text": "=fromAi('text', 'STRING', { description: 'a one-line summary of the outage report', required: true })"
        }
      }
    ]
  }
}

model holds one element, and tools holds a list. Connections are not part of the definition, so the model and the Slack tool still need a connection selected in the editor.


Cluster Element Types

A cluster element is a component attached to a slot of the AI Agent instead of being connected as a step in the workflow graph. Each slot has a type that controls which components fit and how many.

Type nameJSON keyUI labelRequiredMultipleWhat it provides
MODELmodelModelYesNoThe chat model the agent calls, with its provider settings (model name, temperature, maximum tokens).
CHAT_MEMORYchatMemoryMemoryNoNoLoads earlier turns of the conversation into the model context and stores new turns after each call.
RAGragRAGNoNoRetrieves relevant documents from a knowledge source and adds them to the prompt.
GUARDRAILSguardrailsGuardrailsNoYesChecks the input and the output: Check For Violations blocks, Sanitize Text masks.
TOOLStoolsToolsNoYesActions the model can call during a turn. Each tool is described to the model by name, description and a JSON schema of its parameters.

Model Slot

The Model slot binds one chat model to the agent.

ProviderReference
Amazon BedrockamazonBedrock/v1
Anthropicanthropic/v1
Azure OpenAIazureOpenAi/v1
DeepSeekdeepseek/v1
Geminigemini/v1
Groqgroq/v1
LiteLLMliteLlm/v1
Mistralmistral/v1
NanoGPTnanoGpt/v1
Nvidianvidia/v1
Ollamaollama/v1
OpenAIopenAi/v1
OpenRouteropenRouter/v1
Perplexityperplexity/v1
Requestyrequesty/v1

Many provider components also have standalone workflow actions (image generation, speech synthesis, transcription, embeddings) that you use outside the agent; see each provider's reference page. Some AI components have standalone actions only and cannot fill this slot. For example, stability/v1 has a Create Image action but no model cluster element.

Model routers

OpenRouter, Requesty, NanoGPT and LiteLLM are routers: one connection gives access to models from many vendors, so you change models by changing only the model name. Use a router to compare models or to send all traffic through one billing account. Use a direct provider (Anthropic, OpenAI, Gemini and others) for a first-party connection to one vendor.


Chat Memory Slot

Chat memory lets the agent recall earlier turns of the same conversation. The slot is labelled Memory and accepts one memory element. Each element has a Conversation ID property: executions that pass the same ID share one history. Choose a backend by durability and latency, or use Vector Store chat memory to recall similar turns instead of the chronological history.

BackendReferenceNotes
Built-inchatMemory/v1Uses the server's chat memory store, set by BYTECHEF_AI_MEMORY_PROVIDER (JDBC by default).
In-MemoryinMemoryChatMemory/v1Kept in the server process; lost on restart.
JDBCjdbcChatMemory/v1Stored in a relational database.
RedisredisChatMemory/v1Stored in Redis.
MongoDBmongoDbChatMemory/v1Stored in MongoDB.
CassandracassandraChatMemory/v1Stored in Apache Cassandra.
Neo4jneo4jChatMemory/v1Stored in a Neo4j graph database.
AWS S3awsChatMemory/v1Stored as JSON objects in an Amazon S3 bucket.
Vector StorevectorStoreChatMemory/v1Recalls semantically similar earlier turns instead of the chronological history.

Each memory component also has workflow actions to read and manage stored conversations outside the agent (Add Messages, Get Messages, Delete Conversation and, except for Vector Store, List Conversations).

Version 2

Built-in, In-Memory, JDBC, Redis and AWS S3 chat memory also have a version 2: chatMemory/v2, inMemoryChatMemory/v2, jdbcChatMemory/v2, redisChatMemory/v2 and awsChatMemory/v2. Version 2 stores each conversation as a session of events, including tool calls. It can compact long histories (Compaction Strategy: sliding window, turn window, token count, or recursive summarization with an optional summarizer Model element), can give the agent a conversation search tool, and has the same four actions. History stored by version 1 is not visible to version 2. MongoDB, Cassandra, Neo4j and Vector Store chat memory have version 1 only.

Chat memory vs Auto Memory

Chat memory and Auto Memory solve different problems, and an agent can use both:

  • Chat memory (this slot) replays the transcript of the current conversation. It is keyed by conversation ID and keeps nothing across conversations.
  • Auto Memory (the Auto Memory Tool in the Agent Utils toolset) stores durable facts the agent decides to keep, such as preferences, learned context and decisions, and makes them available in every later conversation of the same deployment. Memory is kept per owner and per environment. In deployed automation workflows the owner is the project deployment. Connected-user embedded workflows run as automation workflows, so their memory belongs to the connected user's project deployment (it is not shown on the Memories page). Embedded integration workflows keep memory per integration instance. During editor test runs the tool is offered, but every call returns an error saying that memory works only once the workflow is deployed. In a microservices deployment every call returns an error saying that memory requires the ByteChef server application.

Auto Memory uses the same storage as the Memories page. To enable it, attach the Auto Memory Tool in the Tools slot.


RAG Slot

RAG (retrieval-augmented generation) retrieves text from a knowledge source at query time and passes it to the model as extra context. The slot accepts one RAG element, which runs on every turn.

StrategyReferenceUse when
Modular RAGmodularRag/v1You want to configure each stage separately: query transformer, query expander, document retriever, document joiner, query augmenter.
Question Answer RAGquestionAnswerRag/v1You want one retrieve-and-answer pipeline with default settings.
Vector Store Document RetrievervectorStoreDocumentRetriever/v1You need the document retriever stage of a Modular RAG pipeline.

The Modular RAG stages are cluster elements of their own: query transformers (Compression, Rewrite, Translation), a Multi-Query Expander, the Vector Store Document Retriever, a Concatenation Document Joiner and a Contextual Query Augmenter, each attached to the Modular RAG element.

Compatible Vector Stores

The retriever stage reads from any of these vector stores:

Vector StoreReference
Couchbasecouchbase/v1
Knowledge BaseknowledgeBase/v1
MariaDB VectormariaDbVectorStore/v1
Milvusmilvus/v1
MongoDB AtlasmongodbAtlas/v1
Neo4jneo4j/v1
OracleoracleVectorStore/v1
pgVectorpgVector/v1
Pineconepinecone/v1
Qdrantqdrant/v1
RedisredisVectorStore/v1
S3 Vector Stores3VectorStore/v1
Typesensetypesense/v1
Weaviateweaviate/v1

RAG slot vs search tool

The RAG slot retrieves on every turn and adds the documents to the prompt, whether or not the question needs them. To let the agent decide when to look something up, attach the vector store's or Knowledge Base's Search tool in the Tools slot instead; the model then calls it only when it needs to. An agent can use both.


Guardrails Slot

Guardrails check the text that flows through the agent: the user's input before the model is called, and the model's reply before it leaves the step. Each check has Validate Input and Validate Output options (both on by default). The slot accepts guardrail parents; the agent fails with an error when more than one Check For Violations or more than one Sanitize Text parent is attached.

Workspace-wide AI Guardrails are a separate feature and are not configured here.

ParentReferenceBehavior
Check For ViolationscheckForViolations/v1Blocks the request or the reply when any attached check finds a violation.
Sanitize TextsanitizeText/v1Masks matched text (PII, URLs, secrets) in place without blocking.

Child detectors

Detectors attach inside a Check For Violations or Sanitize Text parent. Rule-based detectors run first; LLM classifiers need a Model element of their own.

DetectorStageReference
PIIRule-basedpii/v1
Secret KeysRule-basedsecretKeys/v1
URLsRule-basedurls/v1
Custom RegexRule-basedcustomRegex/v1
KeywordsRule-basedkeywords/v1
JailbreakLLM classifierjailbreak/v1
NSFWLLM classifiernsfw/v1
Topical AlignmentLLM classifiertopicalAlignment/v1
LLM PIILLM classifierllmPii/v1
CustomLLM classifiercustom/v1

The TypeSafe AI component adds two more detectors for Check For Violations, Jev Input Guardrail and Jev Output Guardrail. They call the TypeSafe service through their own connection and need no Model element.

See Guardrails for detector settings, thresholds and the failure behavior.


Tools Slot

Tools turn workflow components into actions the agent can call during a conversation. The slot accepts any number of tools; the model chooses which to call from the user's prompt and the tool descriptions.

Tool sourceReferenceNotes
Agent UtilsaiAgentUtils/v1Built-in tools; see The Agent Utils toolset.
Any component actionComponents referenceMost ByteChef actions can be attached as tools.
MCP ClientmcpClient/v1Connects the agent to an external MCP server and exposes that server's tools.
Vector store or Knowledge Base searchThe Search tool of any supported vector store or of knowledgeBase/v1Retrieval the model calls when it needs it, unlike the RAG slot, which runs on every turn.
Scriptscript/v1Runs custom JavaScript or Python as a tool.
Workflowworkflow/v1The Call Workflow tool runs another workflow as a tool.
Request Approvalapproval/v1Pauses the run until a human approves or rejects, and returns the response to the agent. See Human in the loop.
A2Aa2a/v1The A2A Agent Tool delegates a task to a remote agent over the A2A (Agent2Agent) protocol. See Call an A2A agent from an AI Agent.
AI AgentaiAgent/v1Lets one agent call another agent as a tool.

Seeing which tools ran

Tool calls are colored on the workflow canvas, live while a test run executes and afterwards on the execution detail of a deployed run.

A tool turns blue while the agent calls it, then green with its duration when the call returns, or red when the call throws an error. Its wire from the Tools slot follows the same color.

  • Only tools are colored. The model, memory, RAG and guardrail elements stay plain, and so does a tool the agent never called.
  • A Task Tool subagent is colored too, along with the tools it calls, including a subagent running in the background, which can finish after its agent's task has.
  • Failure means the call threw. A tool that returns an error message as its result has completed; the model reads that result and decides what to do next.
  • Red stays red. A tool that failed once stays red for the rest of the run, even if a later call succeeds or the agent recovers and finishes.
  • A tool called several times in one run of the agent shows the time from its first call to its last, and stays blue while any of its calls is still running. When the agent itself runs again, in a loop for example, the times add up. A call waiting on a human-in-the-loop answer stays blue until it resumes.
  • Simulated calls are colored like real ones.

Each tool call is also a row of its own under the agent's task row, in the test output and in the execution detail:

  • One row per call, in the order the calls happened. A tool called several times gets numbered rows, such as fetch_ok and fetch_ok #2.
  • Selecting a row shows that call's Input, Output or Error, and its Logs show only the entries from that call. On the execution detail, Input and Output are read from the call's log entry. A tool backed by an external provider, such as an MCP Client tool, has no logs of its own, so its Logs tab shows only that entry. The agent's own Logs tab is unchanged.
  • Rows appear live. During a test run a row appears as soon as the call starts and fills in when it returns.
  • A Task Tool subagent nests three levels deep. The agent's Task call is a row (its Input is the prompt, its Output the result), the subagent run is nested under it, and the tools the subagent called are nested under that run. A background run's result is collected by separate Task output calls, which are rows under the agent.
  • Long values are cut off while a test runs. A live row's input or output over 65,536 characters is truncated and ends with a marker giving the original length. The execution detail shows the full value from the call's log entry.
  • A call waiting on a human reads "Waiting for a response" and completes with the answer when the run resumes. Its Input and Output appear on the execution detail once it completes.
  • A background subagent's call that was still running when the agent finished reads "Still running when the agent finished".
  • Only tools and Task Tool subagents get rows. The model, memory, RAG and guardrail elements do not, unless they fail, block or redact, as described below.

The model, chat memory, RAG and guardrail elements stay grey on a normal run and get a row only in these cases:

Element and eventCanvasAgentRow
Model, chat memory or RAG raises an errorThe element turns redFailsShows the error
An error from below a guardrailThe guardrail turns redFails (no blocked message or withheld text is produced)Shows the error
A Check For Violations check blocks the input or the outputThe check and its Check For Violations frame turn amberStays green with a Blocked badgeShows the side (input or output) and the match count or confidence score
A check cannot run because its model failedReads "could not run"
A check crashesThe check turns red
A Sanitize Text sanitizer changes the textThe sanitizer turns blueUnchangedDetails show how many values were masked
A sanitizer crashesThe sanitizer turns red and its Sanitize Text frame turns amberThe reply is withheld; Withheld badge

Guardrail rows have a Details tab instead of Input and Output. They never show the matched or redacted text, only which check or sanitizer, which side and how many.

Supplying tool parameters with fromAi

When you attach a tool, you see its full input form. For every parameter you decide who fills it:

  • You - type a constant or insert a data pill. The value is the same on every call, and the model neither sees nor controls it.
  • The model - set the field to a fromAi(...) expression. At call time the model provides the value, and the parameter is part of the tool's JSON schema that the model sees.

The Generate content with AI button (sparkles icon) next to a field writes the fromAi(...) expression for you. On dropdowns, true/false fields and code editors, the button appears once you turn on the field's Text or Formula switch, because the expression replaces the regular control.

The expression form is:

=fromAi('<name>', '<type>', { description: '<hint>', required: true })
ArgumentRequiredDefaultDescription
nameYesParameter name the model sees. Characters other than letters, digits, _, . and - are replaced with _, and the name is cut to 64 characters.
typeNoSTRINGOne of STRING, NUMBER, INTEGER, BOOLEAN, ARRAY, OBJECT, DATE, TIME, DATE_TIME.
options mapNodescription (tells the model what to pass), defaultValue, options (a list of allowed values) and required (default false).

A tool can be partly fixed and partly filled by the model. For example, a Slack message tool can pin the channel and let the model write the text:

channel: general
text: =fromAi('text', 'STRING', { description: 'the message body to post' })

The same fromAi syntax selects which tool parameters the AI fills for MCP server tools and embedded MCP tools.

The Agent Utils toolset

Agent Utils provides built-in tools you attach one by one. See Agent Utils Tools for details on each.

ToolWhat the agent can do with it
Skills ToolConsult operator-authored skills on demand.
Create AI Skill, Update AI Skill, Append Files to AI Skill, Remove File from AI Skill, Delete AI SkillManage skills from within a conversation.
Todo Write ToolKeep a task list with state tracking during the run.
Task ToolDelegate work to Subagent elements you define, each with its own instructions, model and tools.
Ask User Question ToolPause and ask the user clarifying questions; the run resumes with the answers. Requires the Chat (stream) action.
Approval Gate ToolRequire a human approval before any tool placed inside it runs.
Auto Memory ToolKeep durable facts across conversations of the same deployment. See Chat memory vs Auto Memory.
Smart Web Fetch ToolFetch a web page and return a summary written by an attached Model, with caching.
Brave Web Search ToolSearch the web through the Brave Search API. Offered only when the server enables Brave.
File System Tools, Glob Tool, Grep Tool, List Directory ToolRead, write and search files in the agent's workspace. Offered only when the server enables them.
Shell ToolsRun shell commands in the agent's workspace. Offered only when the server enables them.

Actions

The AI Agent has two actions. Both have the same properties.

ActionNameBehavior
ChatchatRuns the agent, including guardrails and tool calls, and returns the final reply when it is complete.
Chat (stream)streamChatSends the reply back token by token as it is generated. The Stream response switch in the AI Agent Editor switches the node between the two actions.

On Chat (stream), rule-based output checks run on each chunk, and an LLM output check runs only if it supports streamed output; the stream is then held back until the check has passed on the whole reply. Sanitize Text masks each chunk separately, so a pattern split across two chunks is not masked, and chunks already sent cannot be recalled. Use Chat when output guardrails must see the full reply.

Properties

PropertyNameTypeDefaultDescription
FormatformatSTRINGSIMPLESIMPLE shows the prompt fields below. ADVANCED takes a list of messages instead.
PromptuserPromptSTRINGThe user message (Simple format). Required.
System PromptsystemPromptSTRINGInstructions for the agent (Simple format).
AttachmentsattachmentsARRAYText or image files to attach (Simple format).
MessagesmessagesARRAYThe conversation so far (Advanced format).
Response > Response Formatresponse.responseFormatSTRINGTEXTTEXT or JSON.
Response > Response Schemaresponse.responseSchemaSTRINGJSON Schema for the structured reply.

See aiAgent/v1 for the full property and output reference.


Structured Output

By default the agent returns plain text. When a later step needs to branch on or map the answer, configure structured output so the agent returns JSON:

  1. Set Response Format to JSON.
  2. In Response Schema, enter a JSON Schema for the shape you expect.

For example, a lead-scoring agent can use this schema:

{
  "type": "object",
  "properties": {
    "score": { "type": "integer", "description": "Lead quality from 1 to 10" },
    "reason": { "type": "string" },
    "nextStep": { "type": "string", "enum": ["call", "email", "discard"] }
  },
  "required": ["score", "reason", "nextStep"]
}

Later steps then read ${aiAgent_1.score}, ${aiAgent_1.reason} and ${aiAgent_1.nextStep}, for example in a Condition that checks ${aiAgent_1.score} with Greater or Equals 7.

The reply is validated against the schema before it leaves the step, so a malformed or incomplete object fails the step instead of passing bad data downstream. Each field of the result is available as a data pill in later steps. The standalone chat actions of the model providers (OpenAI, Anthropic, Ollama and others) have the same Response Format and Response Schema properties.


How a Turn Executes

  1. Input guardrails. Checks with Validate Input run on the user prompt. If a Check For Violations check finds a violation, the model is not called and the agent returns the blocked response. Sanitize Text masks matches in the prompt.
  2. Chat memory load. If a memory element is attached, earlier turns for the same conversation ID are added to the model context.
  3. RAG retrieval. If a RAG element is attached, it retrieves documents and adds them to the context.
  4. Model call. The model generates a reply, possibly with tool calls.
  5. Tool execution. The agent runs each requested tool, returns the results to the model and repeats until the model gives a final answer.
  6. Output guardrails. Checks with Validate Output run on the reply. Check For Violations blocks it, and Sanitize Text masks matches. A reply that contains only tool calls and no text is passed through unchanged.
  7. Chat memory write. The new turn is stored for the next call.

Best Practices

Choose the smallest model that meets your quality bar

A small, fast model is often enough for classification and most tool calling. Use a larger model where reasoning quality changes the result.

Pass a stable conversation ID to chat memory

If the conversation ID changes on every execution, the agent loses earlier turns. See chatMemory/v1.

Use guardrails on both sides

Use Check For Violations for adversarial input such as jailbreak attempts, NSFW content and secret leaks. Use Sanitize Text to mask sensitive data that tool results or retrieved passages put into the reply.

Write precise tool descriptions

The model picks tools by their descriptions. A vague description such as do stuff leads to wrong or missed calls. Describe what the tool does, which inputs it needs and what it returns.

Test with Evals

Use Evals (coming soon) to catch regressions when you change the model, a guardrail or a tool.


Frequently Asked Questions (FAQs)


How is this guide?

Last updated on

On this page