Building AI agents in Tines Stories — tips and tricks for advanced builders

Colleen GallagherSenior Customer Success Engineer, Tines
Michael TolanSenior Engineer - Customer Experience, Tines
Cover image for Building AI agents in Tines Stories — tips and tricks for advanced builders

This is the second in a two-part series on AI agents in Tines Stories. Part one covers the foundations: when to use agents, how to configure them, how to write prompts that work, and how to build securely. This post goes deeper on the patterns that separate robust, well-built agents from just good enough ones.

1. Optimize token usage

Every token costs credits and adds additional complexity for the agent to reason through. Token consumption should be treated as a key design constraint.

Minimize what goes in

  • Truncate input data ruthlessly. Use upstream Event Transform actions to extract relevant fields before passing data to the agent. A 10,000-line log trimmed to 50 key lines produces faster, cheaper, and often better results.

  • Shape data at the tool boundary. When an agent calls a custom tool or Send to Story, use an Event Transform at the end of that sub-story to return only the 3–5 fields the agent actually needs. This is one of the highest-impact optimizations you can make.

  • Audit your prompt. For every piece of data in the prompt, ask: does the agent actually need this? If not, remove it.

Minimize what comes out

  • Define an output schema. Without a schema, agents tend to be verbose with explaining reasoning, adding caveats, or returning data you didn't ask for. A structured schema forces concise, predictable responses and makes downstream parsing reliable.

  • Right-size the reasoning level. Higher reasoning means more internal thinking tokens that you pay for but don't see. Start low and increase only if needed.

2. Architecture: scope agents tightly

One agent, one job

Rather than building one monolithic agent that handles an entire workflow, segment the work into multiple, narrowly-scoped agents, each responsible for specific tasks. 

This approach:

  • Reduces token usage, so that each agent only receives the context it needs

  • Reduces credit consumption: smaller prompts = fewer credits per run

  • Improves accuracy as LLMs perform better with focused, specific instructions

  • Makes debugging easier by being able to isolate which agent is underperforming

Give agents only the tools they need

The more tools an agent has, the more the model has to reason about which one to use. This increases token consumption and the chance of errors. If an agent's job is to classify a phishing email, it doesn't need a tool to create a Jira ticket.

MCP servers as tools

Tines Stories supports MCP (Model Context Protocol) servers as tools for the AI Agent action. Connect your agent to external MCP-compatible tool servers which gives the agent access to capabilities hosted outside of Tines Stories without building custom tool sub-stories. You can also build MCP servers in Tines Stories to expose your workflows as tools for agents running on other platforms.

Keep skills lean with progressive disclosure 

Skills are only loaded into context when relevant, but a bloated skill undermines the benefit the moment it's triggered. Audit skills the same way you'd audit a prompt: if a section isn't pulling its weight, cut it. 

Rather than writing everything into the skill itself, store detailed reference material, such as edge cases, less common procedures, and lengthy examples in a third party tool or a Tines Resource.

Give the agent a tool to fetch that information on demand, and instruct the skill to call it only under specific conditions (e.g. "if the standard steps don't resolve the request, fetch the extended troubleshooting reference"). This keeps the base skill lean for the common case while still giving the agent depth when it's actually needed.

3. AI with human-in-the-loop

Knowing when to involve a human and how to make it as frictionless as possible is one of the most important design decisions for agents running at scale.

Pre-process and recommend; let humans handle easy denies

Use the agent to triage and recommend, then route uncertain or high-risk items to humans. Easy denies are high-frequency, low-risk, and quick to review. This is a natural place to keep humans in control while the agent handles confident approvals autonomously.

AI-drafted responses with human approval

Have the agent draft a response, whether it's email, Slack message, ticket comment, remediation plan, etc. and present it to a human before sending. The human isn't doing the work; they're just validating it. This is fast for the reviewer and catches hallucinations before they reach the end user.

AI triage → human escalation

Let AI handle initial triage of all incoming alerts or tickets, including classifying, enriching, and prioritizing. Only items that exceed a risk threshold, or where the agent's confidence is low, get escalated to a human. This dramatically reduces alert fatigue without removing human judgment from decisions that warrant it.

Conversational agents for self-service

Deploy an AI agent as a chatbot via Slack or a Tines Page to handle routine requests conversationally. Humans are only involved when the agent can't resolve the request or when elevated permissions are required.

Document processing and classification

AI excels at reading unstructured documents, classifying them, and extracting key data — tasks that are tedious for humans but imprecise for purely deterministic logic. The human role here is reviewing flagged or low-confidence results rather than processing every document manually.

4. Error handling and fallbacks

AI agents can fail like any other action, due to timeouts and rate limits, but they also introduce failure modes tied to how they consume tokens and credits, like context limits and runaway usage.

Configure retries and timeouts

The AI Agent action supports configurable retries and timeouts directly on the action. Set a retry count to automatically retry on transient failures, and a timeout threshold to prevent the action from hanging indefinitely. Tines Stories will log each retry attempt and only surface a final error once all retries are exhausted.

Set token threshold alerts

From the Status tab on the action's properties panel, you can configure two types of credit threshold alerts:

  • Notify: when token usage exceeds a defined threshold (daily, weekly, monthly, or all time), Tines Stories notifies the story's recipients

  • Disable action: when the threshold is exceeded, Tines Stories notifies recipients and automatically disables the action to prevent further credit consumption

This is especially important for high-volume agents where runaway credit usage is a real risk.

Use the metadata field for custom safeguards

Every event emitted by the AI Agent action includes a meta field containing token usage, credit usage, and the model used. You can reference this downstream in a condition to build custom limit-handling logic. For example, routing to a fallback path if credit usage exceeds a threshold, or alerting if a run consumed significantly more tokens than expected.

Route failure events explicitly

Like all Tines Stories actions, the AI Agent action supports downstream failure routing. Connect the failure path to a notification action, a logging action, or an alternative workflow path. Combined with the story and action monitoring, this ensures failures are surfaced and handled rather than silently dropped.

5. Verifying AI performance

AI agents are non-deterministic, meaning that the same input can produce different outputs across runs, which requires ongoing verification.

Challenger agents

For decisions that carry real consequences, use a second agent to review and challenge the output of the first. The challenger receives the original input plus the first agent's output and checks for:

  • Logical consistency

  • Hallucinated facts or unsupported conclusions

  • Schema and format compliance

  • Confidence concerns

This is especially valuable for high-stakes decisions. The challenger agent’s job is focused purely on critical evaluation. Use a different model or higher reasoning level for the challenger because if both agents share the same model, they're more likely to share the same blind spots.

Pattern:

  • Agent A performs the task (e.g., classifies an alert as "critical")

  • Agent B receives the alert + Agent A's classification and asks: "Is this classification justified given the evidence? What might Agent A have missed?"

  • If Agent B disagrees → route to human review

  • If both agree → proceed with confidence

Log decisions to Tines Records

Log every AI agent decision to Tines Records to create an auditable trail. For each run, record the input, the agent's output, the model used, any confidence score, and the final outcome.

Over time, this lets you:

  • Spot patterns in failures: is the agent consistently wrong on a specific alert type?

  • Measure accuracy rates: what percentage of AI decisions get overridden by humans?

  • Make a data-driven case for removing human-in-the-loop on certain decision paths

  • Compare model performance before and after switching models

Human review sampling

You don't need humans to review every AI decision to maintain quality, but you may need a statistically meaningful sample

  • Random sampling: Route a random percentage (e.g., 5–10%) of AI decisions to a human reviewer, regardless of confidence. This catches systemic issues that confidence scores won't reveal.

  • Stratified sampling: Sample more heavily from categories where the agent has historically underperformed.

  • Honeypot testing: Periodically inject known-good and known-bad test inputs into the workflow to verify the agent handles them correctly. If the agent misclassifies a honeypot, trigger an alert.

Use a Condition with a formula like RANDOM() to randomly route a percentage of events to a human review queue. When humans review sampled decisions, store their verdicts alongside the original AI decision in Tines Records. Over time this turns sampling from a spot-check into a real performance dataset you can use to identify drift, tune prompts, and make a data-driven case for adjusting how much oversight a particular decision path needs.

Feedback loops that improve over time

Design your verification to feed back into improvement:

  • Log override reasons. When a human overrides an AI decision, log the override reason to Records alongside the original AI decision.

  • Track performance over time. Analyze override rates, accuracy, and decision patterns over time and set thresholds that trigger prompt tuning. 

  • Build a library of edge cases. Use Resources to store edge cases that you can easily reference and keep up to date in the system instructions or skills.

This entire feedback loop can itself be automated. Use a dedicated agent to periodically pull decision data from Records, analyze patterns in overrides and outcomes, and surface specific recommendations for updating prompts or skills. This turns verification from a manual review process into a continuous improvement cycle.

Building agents that hold up at scale isn't about any single technique. It's the combination of tight scoping, efficient token usage, the right level of human oversight, and continuous verification that makes the difference between an agent you trust and one you're constantly second-guessing. Treat these patterns as an ongoing practice, not a one-time setup, and your agents will keep getting more reliable the longer they run.

Sign up today to get started or schedule time with our team to learn more.