DEVELOPER GUIDE REASON + ACT, TRACED

Agentic AI in practice: real-world examples

Four worked examples with the actual reason → act → observe trace played out step by step, so you can see exactly what an agent does between receiving a task and finishing it — not just the theory behind it.

01
EXAMPLE

Customer support: handling a refund request

Scenario: A customer messages support: "My order #48213 arrived damaged, I want a refund." The agent has tools to look up orders, check the refund policy, issue refunds, and send confirmation emails.
Tools availableorder lookup · policy check · refund API · email
Loop length4 turns
Guardrailrefunds over $200 require human approval
Reason
The agent needs order details before it can do anything — it can't judge eligibility from the message alone.
Act
Calls the order lookup tool.
get_order(order_id="48213")
Observe
Result: order total $34.99, delivered 3 days ago, status "delivered."
Reason
$34.99 is well under the $200 approval threshold and the order is within the return window — it checks the policy tool to confirm damaged items qualify.
Act
Calls the refund policy tool, then the refund API.
check_policy("damaged item") → issue_refund(order_id="48213", amount=34.99)
Observe
Refund confirmed, transaction ID returned.
Act
Sends a confirmation email and replies to the customer, then stops — the goal is met.
send_email(to=customer, template="refund_confirmed")
02
EXAMPLE

Software engineering: fixing a failing test

Scenario: A developer asks an agent to fix a failing test in a checkout module. The agent has tools to read files, search the codebase, edit files, and run the test suite.
Tools availableread file · grep/search · edit file · run tests
Loop length5 turns
Guardrailchanges shown as a diff before being applied
Act
Runs the test suite first to see the actual failure rather than guessing from the description.
run_tests("checkout/")
Observe
Output: AssertionError: expected total=45.00, got total=40.50 in test_apply_discount.
Reason
The discount math looks wrong. It needs to see the function under test before changing anything.
Act
Reads the relevant source file.
read_file("checkout/discount.py")
Observe
Finds the discount is applied twice — once in the cart total and again in the checkout step.
Act
Edits the file to remove the duplicate discount application, then re-runs the tests to check the fix.
edit_file(...) → run_tests("checkout/")
Observe
All tests pass. It stops and reports the fix and the reasoning behind it back to the developer.
03
EXAMPLE

Research: competitive pricing summary

Scenario: "Find out how our three main competitors price their starter plans and summarize it in a table." The agent has web search and a document-writing tool.
Tools availableweb search · page fetch · document writer
Loop length~7 turns (parallel searches)
Guardrailcites the source page for every price quoted
Reason
It needs current pricing for three named companies — this can't come from memory, since pricing changes often.
Act
Runs three searches, one per competitor.
search("Competitor A pricing") · search("Competitor B pricing") · search("Competitor C pricing")
Observe
Gets a pricing page link for A and B, but C's result is a stale blog post, not their pricing page.
Reason
The result for C isn't reliable enough to quote a number from — it decides to search again with a more specific query.
Act
Refines the search and fetches the actual pricing page.
search("Competitor C plans site:competitorc.com") → fetch(url)
Observe
Now has current starter-plan prices for all three, each tied to a source URL.
Act
Writes the comparison table with a citation column, then stops.
04
EXAMPLE

Operations: responding to a service alert

Scenario: A monitoring system fires an alert: "API error rate above 5% for 10 minutes." The agent has tools to query logs, check metrics dashboards, restart a service, and page an on-call engineer.
Tools availablelog query · metrics query · restart service · page on-call
Loop length4 turns
Guardrailrestart requires it, but a rollback requires human approval
Act
Pulls recent error logs to find the actual failure, not just the alert summary.
query_logs(service="checkout-api", window="15m", level="error")
Observe
Logs show repeated connection pool exhausted errors, starting right after the last deploy.
Reason
This pattern usually clears with a restart, but it's correlated with a deploy — a restart is safe to try first, but if it recurs, this looks like a rollback candidate, which needs a human.
Act
Restarts the affected service instances.
restart_service("checkout-api")
Observe
Error rate drops to normal within two minutes.
Act
Because the errors began right after a deploy, it pages the on-call engineer with a summary and a rollback recommendation, instead of rolling back itself.
page_oncall(summary, recommend="rollback if recurs")
05
PATTERN

What all four examples have in common

ExampleWhat it couldn't have done in one shotWhere the guardrail sits
Support agentDidn't know the order details or eligibility until it looked them upDollar threshold routes large refunds to a human
Coding agentDidn't know the real cause of the failure until it ran the tests and read the codeDiff shown before changes are applied
Research agentDidn't have current prices in memory and had to recover from a bad first searchEvery number is tied to a cited source
Incident agentDidn't know the root cause until logs were pulled after the alert firedReversible action (restart) is autonomous; risky one (rollback) isn't

In every case, the value came from the loop — the ability to look something up, be wrong or incomplete, and correct course — not from the model being smarter in isolation.

06
DESIGN

Step by step: designing your own agentic workflow

  1. Write the goal as a sentence, not a flowchart

    "Resolve the customer's refund request" — not "look up order, then check policy, then...". If you find yourself writing the flowchart, you may want a simpler pipeline instead of an agent.

  2. List the minimum tools needed to reach that goal

    Start narrow. Each of the four examples above used three or four tools, not a dozen — fewer tools means fewer wrong choices.

  3. Decide what "done" looks like

    A refund issued, a test passing, a report written, an alert resolved or escalated — give the agent a concrete, checkable stopping condition.

  4. Mark the irreversible actions

    Anything like the refund, the rollback, or a message sent to a real customer needs a threshold, an approval step, or a stricter check than everything else the agent does.

  5. Run it on real cases and read the full trace

    Don't just check the final answer — look at what it searched for, what it read, and where it changed its plan. That's where you'll find the fragile steps worth hardening.