Skip to main content

Creating an agent

Agents are AI assistants that know your business. They read your documents, watch your videos, and listen to your audio, then answer questions and automate work.

The saved Support Triage Agent branches from an urgency assessment into escalation, an automated response, or a request for more details.
The saved Support Triage Agent branches from an urgency assessment into escalation, an automated response, or a request for more details.

Start with one task and a small set of documents. Define what a successful response looks like, what information the agent needs, and when it should ask for help.

Your agents use your company's documents to answer questions. They can cite sources, understand your terminology, and make decisions based on your actual data. Search your documents at Enterprise Search.

Prerequisites

You need to have:

  • A Docana account with appropriate permissions
  • An existing application (see Creating an Application if you need to create one first)

Video: creating an agent

Creating an AI agent for your application

You can also build from your preferred AI client through MCP. This tutorial follows the platform interface.

Plan your agent

Choose the knowledge it needs

Agents can work with content from text, images, video, and audio. Use the documents and collections that are relevant to the task, and wait for file processing to finish before testing.

Try specific questions such as "What does the chart on page 5 show?" or "Where does the training video explain safety procedures?" Check the cited source against the answer.

Define checks and fallback paths

Use evaluation criteria in decision nodes to check whether the workflow has enough information to continue. Configure what happens when a check fails: ask a follow-up question, take another branch, or hand off to a person.

Add test cases for each of these paths. Model-based evaluations help you identify problems, but do not make every response identical or correct.

Agents know your business

Agents use your company's documents to answer questions. They can:

  • Cite specific documents
  • Understand your company's terminology
  • Use historical information
  • Make decisions based on your actual data

Step 1: Create a new agent

  1. Click Applications in the sidebar
  2. Pick the application where you want to add an agent
  3. Click Agents in the application header
  4. Click Create New Agent
The Agents page lists the workflows in this application and has a Create New Agent action.
The Agents page lists the workflows in this application and has a Create New Agent action.

Step 2: Set up your agent

Enter these details:

Basic information

  1. Name: Pick a name that describes what the agent does (e.g., "Customer Support Bot", "Contract Analyzer", "Sales Assistant", "HR Policy Expert").

  2. Description (optional): Explain what the agent does. This helps your team and helps the agent understand its role.

  3. Instructions: Define the agent's role and how it should behave. Include:

    • What the agent does
    • How it should talk (formal, friendly, technical)
    • What it should and shouldn't do
    • How to handle questions it can't answer

    Example:

    You are a customer support assistant helping users with their inquiries. Your role is to evaluate support tickets for urgency and complexity, then route them appropriately.

    For urgent issues (account lockouts, payment problems, security concerns) or complex technical problems, escalate to a human agent.

    For common questions (pricing, features, account settings), provide helpful automated responses.

    When information is missing, ask clarifying questions to gather necessary details.
The new agent form starts with a template. Review its name, description, instructions, and execution settings.
The new agent form starts with a template. Review its name, description, instructions, and execution settings.

Additional settings (optional)

  1. Environment: Select an environment to use environment variables in your agent's workflow. Environments help you manage different configurations for development, staging, and production.

  2. Coordinator: When enabled, this agent will wait for other agents to complete their evaluations first, then receive their results as context to make coordinated decisions. Useful for synthesizing insights from multiple agents in document insights workflows.

  3. Respond with Audio: When enabled, the agent will respond with audio when the user sends audio messages. This is particularly useful for WhatsApp voice interactions.

Knowledge base

After creating your agent, you can configure which documents the agent can use by building its workflow. Collections and libraries are configured in the agent's workflow nodes, not in the basic information form. Manage your knowledge base at Knowledge Libraries.

Build the employee’s workflow

In the Build tab, click Build with AI and describe the work you want to automate in a conversation. It proposes nodes, prompts, and decision logic. Review the generated configuration, connect the required tools and knowledge, and test it before publishing.

How it works

  1. Start a Conversation: After creating your agent, open the Build tab and click Build with AI
  2. Describe Your Agent: Tell the AI what you want your agent to do. You can use the suggested templates or describe your own use case
  3. Refine Step by Step: The AI will help you design the workflow, prompts, and decision logic
  4. Review and Adjust: Check the generated configuration in the right panel and make adjustments as needed

The conversational builder is useful for:

  • Complex workflows with multiple decision points
  • Agents that need to integrate with external services (email, webhooks, etc.)
  • Custom logic that requires conditional branching
  • Rapid prototyping and iteration
Build with AI opens a conversation beside the agent configuration. Describe the changes, then review the resulting workflow.
Build with AI opens a conversation beside the agent configuration. Describe the changes, then review the resulting workflow.

You can also start from scratch by clicking Start from Scratch to manually configure your agent without using the conversational builder.

Creating a reasoning

A reasoning (also called an evaluation criterion) is a way to measure how well your agent performs specific tasks. Think of it as a quality check that evaluates whether your agent's responses meet certain standards or requirements.

Define evaluation criteria

Reasonings are evaluation criteria that define what "good" looks like for your agent's responses. They help you:

  • Measure performance: Understand how well your agent handles different types of questions
  • Set quality standards: Define what information should be included, what format to use, or what logic to follow
  • Improve over time: Use reasoning results to refine your agent's workflow and instructions

Each reasoning consists of:

  • Evaluation criteria: A description of what should be evaluated (e.g., "Response includes order number", "Answer is specific and detailed")
  • Evaluation steps: Step-by-step instructions for how to evaluate the response
  • Structured data parameters: Optional fields to extract specific information from the response

Reasonings are used in decision nodes within your agent's workflow to route conversations and evaluate results. They can also be used to test your agent and measure its performance over time.

Video: creating a reasoning

Creating a reasoning to evaluate agent performance

Modeling agent flow

Your agent's workflow defines how it processes user questions and generates responses. The flow consists of different types of nodes connected together:

  • Instruction nodes: Provide guidance on how to respond, optionally searching Google while they run
  • Reasoning nodes: Extract structured insights before generating responses (used in complex flows)
  • Decision nodes: Use evaluation criteria to route the conversation based on the context
  • Webhook nodes: Integrate with external services
  • JavaScript nodes: Transform data with code for exact math, parsing, and formatting without an LLM call

Here's how those nodes fit together in a customer-support agent that evaluates each message, then routes it:

A single step can do more than reply. Action nodes also send email, call your APIs, generate documents, schedule follow-ups, or hand off to another agent.

An explicit workflow makes the available paths easier to inspect and debug. Decision nodes that use a model can still choose different paths as the conversation, knowledge, or model changes. Use JavaScript nodes for exact calculations and transformations, and add tests for important branches.

Modeling your agent's flow involves:

  1. Understanding the different paths your agent might take
  2. Defining decision points where the flow branches based on conditions
  3. Configuring reasoning steps to extract relevant information
  4. Setting up instructions that guide the agent's responses

Video: modeling the agent flow

Modeling the flow of an agent workflow

Testing an agent

Testing your agent ensures it performs well before deploying it to users. You can test your agent by:

  1. Manual testing: Use the chat interface to try different questions and scenarios
  2. Automated testing: Create test cases with expected outputs and evaluation criteria
  3. Performance monitoring: Review reasoning results to identify areas for improvement

When testing, consider:

  • Edge cases: Unusual or unexpected inputs
  • Different question types: Short queries, multi-step requests, ambiguous questions
  • Response quality: Accuracy, completeness, relevance, and format
  • Source citations: Whether the agent correctly references its knowledge base

Video: testing an agent

Testing an agent to ensure quality and performance

Step 3: Save and test

  1. Click Create to save your agent
  2. Use the chat interface to test it
  3. Try different questions, including edge cases
  4. Check that sources are cited correctly
  5. Make adjustments if needed

Using your agent

Once created, your agent is automatically enabled and ready to use in your application. You can access it through:

Web

Put your agent on your website or in your app. Use the embed code or API. Set up at Developer Integrations.

WhatsApp

Let customers talk to your agent on WhatsApp. Good for:

  • Customer support
  • Order questions
  • Product info
  • Scheduling

WhatsApp is configured at the application level, not the agent level. To set up WhatsApp:

  1. Go to your application settings
  2. Navigate to the Plugins section
  3. Enable WhatsApp and configure your phone number
  4. Optionally, select a specific agent for routing (or use automatic routing)

You can also create custom integrations for other channels using the Developer Integrations API.

Disabling an agent

If you need to temporarily disable an agent (for example, during maintenance or testing), you can disable it from the Agents list:

  1. Go to the Agents section in your application
  2. Find the agent you want to disable
  3. Click the three-dot menu (⋮) on the agent card
  4. Select Disable from the menu
  5. Confirm the action in the dialog that appears

When disabled, the agent will not respond to user queries, but all its settings and conversation history are preserved. You can re-enable it at any time by selecting Enable from the same menu.

Open an agent card menu to change whether it is enabled.
Open an agent card menu to change whether it is enabled.

Managing agents

From the Agents list, you can:

  • Edit: Click an agent name to modify settings
  • Enable/Disable: Click the three-dot menu (⋮) on an agent card and select Enable or Disable
  • Inspect: Open Build, Evals, Insights, Routines, Logs, or Stats from the three-dot menu
  • Export: Click the three-dot menu and select Export to download the agent configuration
  • Delete: Click the three-dot menu and select Delete to remove permanently (this deletes all conversation history)
tip

Test changes in a staging environment first, especially for customer-facing agents.

Best practices

  1. Write clear system prompts: Define the agent's role, tone, and limits. Include examples of good responses and what the agent should not do.

  2. Give access to relevant documents only: Only include collections the agent needs. This makes it more accurate and faster.

  3. Configure model tiers in workflow nodes: When building your agent's workflow, you can configure model tiers (lite, regular, pro) for specific instruction nodes. Use better models for important decisions, cheaper models for routine questions.

  4. Test before deploying: Try edge cases and tricky questions before letting users access the agent.

  5. Add human handoff: For customer-facing agents, let them escalate to humans when they can't help.

Use case examples

Customer service agent

  • Purpose: Handle common customer inquiries 24/7
  • Knowledge: Product documentation, FAQs, return policies
  • Deployment: WhatsApp, website chat
  • Key features: Order tracking, product recommendations, support ticket creation

Contract review assistant

  • Purpose: Help legal teams review contracts faster
  • Knowledge: Standard contract templates, legal guidelines, past contracts
  • Deployment: Internal web application
  • Key features: Risk identification, clause comparison, compliance checking

HR policy expert

  • Purpose: Answer employee questions about policies and benefits
  • Knowledge: Employee handbook, benefits documents, compliance materials
  • Deployment: Internal portal, web application
  • Key features: Policy lookup, vacation balance queries, onboarding guidance

Sales assistant

  • Purpose: Help sales teams with product information and competitive intelligence
  • Knowledge: Product specs, pricing, competitive analysis, case studies
  • Deployment: Web application, CRM integration (via custom integrations)
  • Key features: Proposal assistance, competitive comparisons, pricing guidance

Next steps