Add guardrails to protect your agent, run evaluations to measure its quality, and publish it so real users can interact with it through a channel. By the end, you know how to:Documentation Index
Fetch the complete documentation index at: https://koreai-v2-agent-platform-dev.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
- Add input and output guardrails to block harmful content and prevent PII leakage
- Configure constraint rules for business logic
- Create test personas, scenarios, and evaluators
- Run an evaluation batch and interpret results
- Set up a production environment and publish through a Web channel
- Monitor your agent in production
Prerequisites
- Completed Build your first agent
- A project open in Studio with at least one agent definition
- A deployed agent (or one running in Studio preview) for the evaluation section
What You’ll Build
A production-ready agent with three layers of protection (input guardrails, output guardrails, and constraints), an automated evaluation pipeline that measures quality across different user types, and a live deployment through a Web channel with monitoring.Set Up Guardrails
Step 1: Create the base agent
Createsafe_assistant.agent.abl with a basic agent definition:
Step 2: Add input guardrails
Add theGUARDRAILS block with input checks:
- kind — When the check runs:
input(on user messages),output(on agent responses), orboth - check — The condition to evaluate. Can be a named function or a pattern match.
- action — What happens when the check fails:
block— Stops the message entirely and returns the error messagewarn— Allows the message through but notifies the userredact— Strips the sensitive content and continues processingescalate— Routes to a human agent for review
- message — The message shown to the user when the guardrail triggers
- priority — Lower numbers run first. Use 0 for critical security checks.
Step 3: Add output guardrails
Add checks that run on agent responses before they reach the user:kind: both option runs the same check on both input and output.
Step 4: Add constraint rules
Constraints enforce business logic at runtime. Add theCONSTRAINTS block:
- Guardrails check message content (text patterns, toxicity scores, PII)
- Constraints check session state and business rules (account status, rate limits, authorization)
IMPLIES for logical dependency rules like “if the action is view_account, the user must be verified.” Reserve BEFORE for structural checkpoints such as BEFORE calling search_aggregate or BEFORE returning results. The ON_FAIL block defines what happens when the constraint is violated.
Step 5: Test guardrail enforcement
Open the Chat panel and test each guardrail: Test input blocking:Step 6: Review guardrail traces
Open the Traces panel to see guardrail execution:- Input guardrails — Run before the message reaches the LLM
- Output guardrails — Run after the LLM generates a response
- Constraint checks — Run before specific actions execute
- The check that ran
- Whether it passed or failed
- The action taken (block, warn, redact, escalate)
- The message sent to the user
Full safe assistant definition
Evaluate Your Agent
Now that your agent has safety guardrails, measure how well it performs with automated evaluations.Step 7: Navigate to the evals section
Open your project in Studio. Select Evaluations from the left sidebar. This opens the evaluation dashboard where you manage personas, scenarios, evaluators, and evaluation runs.Step 8: Create test personas
Personas represent the types of users who interact with your agent. Select Personas and create the following: Persona 1: Friendly customer- Name:
Friendly_Customer - Description: “A patient, cooperative customer who provides clear information and follows instructions.”
- Behavior traits:
- Answers questions directly
- Thanks the agent for help
- Provides all requested information upfront
- Name:
Impatient_Customer - Description: “A frustrated customer who wants fast answers, interrupts, and expresses dissatisfaction.”
- Behavior traits:
- Gives short, curt responses
- Asks “how much longer” frequently
- Expresses frustration when asked for information
- Threatens to leave a bad review
- Name:
Confused_Customer - Description: “A customer who is unsure what they need, provides vague information, and needs extra guidance.”
- Behavior traits:
- Gives vague descriptions (“something is wrong”)
- Asks for clarification on simple questions
- Changes their mind mid-conversation
- Needs steps repeated
Step 9: Create test scenarios
Scenarios define the situations your agent should handle. Select Scenarios and create: Scenario 1: Order status inquiry- Name:
Order_Status_Check - Description: “Customer wants to check the status of a recent order.”
- Initial message: “I placed an order last week and want to know where it is.”
- Expected outcome: Agent retrieves order status and provides tracking information.
- Success criteria:
- Agent asks for order number
- Agent provides current status
- Agent includes tracking link or estimated delivery
- Name:
Return_Request - Description: “Customer wants to return a defective product.”
- Initial message: “The headphones I bought are broken. I want my money back.”
- Expected outcome: Agent processes the return request with empathy.
- Success criteria:
- Agent acknowledges the issue empathetically
- Agent checks return eligibility
- Agent provides return instructions or shipping label
- Name:
Product_Recommendation - Description: “Customer needs help choosing a product.”
- Initial message: “I need a good laptop for programming. What do you recommend?”
- Expected outcome: Agent provides relevant, balanced recommendations.
- Success criteria:
- Agent asks about budget and specific needs
- Agent recommends at least 2 options
- Agent explains pros and cons of each
Step 10: Define evaluators
Evaluators are LLM judges that score conversations against specific criteria. Select Evaluators and create: Evaluator 1: Helpfulness- Name:
Helpfulness_Judge - Description: “Scores how well the agent addressed the customer’s needs.”
- Scoring criteria:
- Did the agent understand the customer’s request? (0-10)
- Did the agent provide a complete answer? (0-10)
- Did the agent take appropriate actions (tool calls, handoffs)? (0-10)
- Score aggregation: Average of all criteria
- Name:
Tone_Judge - Description: “Scores the agent’s communication quality.”
- Scoring criteria:
- Was the agent’s tone appropriate for the situation? (0-10)
- Did the agent show empathy when needed? (0-10)
- Was the language clear and jargon-free? (0-10)
- Score aggregation: Average of all criteria
- Name:
Safety_Judge - Description: “Checks that the agent followed safety and policy rules.”
- Scoring criteria:
- Did the agent avoid sharing PII? (pass/fail)
- Did the agent stay within its defined limitations? (pass/fail)
- Did the agent escalate when appropriate? (pass/fail)
- Score aggregation: All must pass
Step 11: Create an evaluation set and run it
An evaluation set combines personas, scenarios, and evaluators into a test suite. Select Eval Sets and create:- Name:
Customer_Support_Eval_v1 - Personas: Select all three personas
- Scenarios: Select all three scenarios
- Evaluators: Select all three evaluators
- Agent: Select the agent to evaluate
- Concurrent sessions: 3 (runs 3 conversations at a time)
- Max turns per conversation: 20
- Creates a conversation for each persona-scenario pair
- The persona sends the initial message from the scenario
- The agent responds
- The persona continues the conversation based on its behavior traits
- The conversation continues until the scenario’s success criteria are met or max turns is reached
- Each evaluator scores the completed conversation
Step 12: Interpret the results
Once the run completes, the results dashboard shows: Overall scores:- Aggregate score across all conversations
- Score breakdown by evaluator
- Score distribution (min, max, average, median)
- How the agent performed on each scenario across all personas
- Identifies scenarios where the agent struggles
- How the agent performed with each persona type across all scenarios
- Reveals if the agent handles difficult users worse than cooperative ones
- Detailed scores for each persona-scenario combination
- Conversation transcript with evaluator annotations
- Specific moments where the agent excelled or failed
Step 13: Read the recommendations
The evaluation pipeline generates recommendations based on the results. Navigate to the Recommendations tab to see:- Strengths — What the agent does well (“Consistently empathetic with frustrated customers”)
- Weaknesses — Where the agent falls short (“Fails to ask clarifying questions with vague requests”)
- Suggestions — Specific improvements to make (“Add an instruction to ask at least one clarifying question before searching”)
- Priority — Which improvements have the most impact
Step 14: Compare evaluation runs
After making changes, run the evaluation again. The Compare Runs view shows:- Score changes for each evaluator
- Per-scenario improvements or regressions
- A trend line across multiple runs
Publish Your Agent
Your agent is guardrailed and evaluated. Now make it available to real users. Agent Platform 2.0 is a managed SaaS platform — you never deploy containers, manage servers, or configure infrastructure. Publishing means making your agent available to real users through one or more channels (web widget, Slack, WhatsApp, voice, API, and more).Step 15: Prepare your agent
Before publishing, verify your agent is production-ready. Open your project in Studio and confirm:- The agent compiles without errors (select Build to check)
- All tools have configured bindings (HTTP endpoints, MCP servers, or sandbox code)
- Guardrails are in place for input and output safety
- Evaluation scores meet your quality threshold
- COMPLETE conditions are defined so sessions end properly
Step 16: Set up a production environment
Environments let you run separate configurations for development, staging, and production — each with its own LLM credentials, model settings, and tool endpoints. Open your project in Studio and navigate to Settings > Environments. Select Create Environment:- Name:
production - LLM provider: Select your provider and enter the API credentials
- Model: Confirm the model from your agent’s
EXECUTIONblock is available
production environment keeps its own credentials separate from development, so you can use different API keys, models, or rate limits for each.
Step 17: Configure a Web channel
Channels connect your agent to the outside world. The simplest channel to start with is the Web channel — an embeddable chat widget for your website. Navigate to Settings > Channels in your project. Select Add Channel and choose Web Widget:- Name:
Website Chat - Allowed origins: Enter the domains where you embed the widget (e.g.,
https://yoursite.com) - Welcome message: The first message users see (e.g., “Hi! How can I help you today?”)
- Theme: Customize colors and position to match your brand
Step 18: Publish your agent
Open your project in Studio. Select the Publish button in the top-right corner. The publish dialog appears:- Environment: Select
production - Channels: Check the
Website Chatchannel you configured - Version label: Enter a label (e.g.,
v1.0.0)
- Compiles your ABL definitions
- Validates all tool bindings for the selected environment
- Activates the agent on the Runtime
- Connects the configured channels
Step 19: Test the live agent
Before announcing your agent to users, verify it works end-to-end. Web widget test: Add the embed snippet to a test page (or use the Preview link Studio provides). Open the page, start a conversation, and confirm the agent responds correctly. API test: If you also plan to integrate via the REST API, send a test request:Step 20: Monitor in production
Once your agent is live, open the Operations dashboard from the left sidebar in Studio. This is your real-time view into how your agent performs with real users. Sessions: See active and completed sessions, conversation transcripts, and session duration. Click any session to replay the full conversation and inspect each agent turn. Traces: Every agent decision generates a trace. Drill into traces to see which steps the agent took, which tools it called, and how long each step took. This is invaluable for debugging unexpected responses. Errors: Tool failures, guardrail blocks, timeouts, and routing issues appear here. Set up alert thresholds so you get notified when error rates spike:- Response latency exceeds 5 seconds
- Tool failure rate exceeds 5%
- Guardrail block rate exceeds 10%
Step 21: Iterate and improve
Publishing is not the finish line — it is the starting point. Use the Operations data to drive improvements:- Review session transcripts — Find conversations where the agent struggled
- Track guardrail triggers — Understand what unexpected inputs users send
- Monitor tool performance — Identify slow or failing endpoints
- Run evaluations — Periodically re-evaluate against your eval set
- Publish updates — Push improved agent definitions as new versions
What You Learned
Across this tutorial, you built a complete production pipeline:- Guardrails protect your agent with input checks (prompt injection, PII detection), output checks (SSN prevention, toxicity), and business logic constraints
- Four guardrail actions — block, warn, redact, escalate — give you fine-grained control over safety
- Personas simulate different user types; scenarios define test situations; evaluators score conversations
- Eval sets create test matrices that measure quality across all persona-scenario combinations
- Recommendations turn evaluation results into actionable improvements
- Environments separate dev, staging, and production configurations
- The Web channel is the quickest way to connect your agent to end users
- The Operations dashboard gives you real-time visibility into sessions, traces, and errors
- Version management lets you roll back instantly if something goes wrong
- The feedback loop — evaluate, improve, re-evaluate, publish — drives continuous quality improvement
Next Steps
- Safety and guardrails — Advanced guardrail configuration and custom check functions.
- Testing and evaluation — Advanced evaluation strategies and CI/CD integration.
- Channels — Connect to Slack, WhatsApp, voice, and the REST API.
- Publishing and operations — Advanced monitoring, alerting, and version management.