AI agents are powerful, but they're not magic. Left unconstrained, they'll burn through credits, hallucinate confidently, and make decisions you can't explain to your team. The fix isn't a smarter model, it's a smarter workflow.
This guide focuses on the foundations of building an agent: when to use agents, how to configure them, how to write prompts that work, and how to build securely from day one. Part two goes deeper to cover token optimization, agent architecture, human-in-the-loop patterns, error handling and verification.
1. Deterministic first, AI second
The instinct when building with AI agents is to let the agent handle everything. This includes fetching data, making decisions, formatting outputs, and calling APIs. But every task you give the agent adds tokens, adds cost, and introduces unpredictability into something that might not need it.
The question to ask at every step is: Does this require reasoning, judgment, or language?
Yes → agent territory
No → do it deterministically with zero token cost and guaranteed consistency
Things that don't require reasoning:
Parsing structured data
Routing based on known conditions
Rigid/template-based formatting (e.g., building API payloads, mapping fields)
Things that do require reasoning:
Classifying unstructured text into categories
Summarizing complex information for a human audience
Making judgment calls with ambiguous or incomplete data
Drafting natural language responses with appropriate tone
Analyzing patterns across multiple data points
If something can be done deterministically, do it outside the agent's context window. This could before the agent, after the agent, or inside tools such as custom tools and Send to Story. Deterministic actions produce the same output every time. They don't hallucinate, they don't drift, and they don't need verification.
Library examples
2. The art of the prompt
System instructions vs. prompts
System instructions define the agent's persona, constraints, and behavior. They persist across every invocation. It’s best to use these for: role definition, output format requirements, guardrails, standing rules.
A prompt is a per-run input i.e. the specific data or question you are providing.
For anything that doesn't change between runs, it's best to use system instructions. For anything that varies per request, it's best to use the prompt.
Writing prompts that hold up
Well-written instructions produce more reliable agent behavior. A few techniques consistently help, especially as prompts grow longer and more complex.
Separate instructions from context. Keep what you're telling the agent to do distinct from the data it's working with.
Be specific and unambiguous. Name exact categories, formats, or outputs. Vague instructions produce vague results.
Order steps when sequence matters. Number steps explicitly rather than listing them as bullets.
Include examples for difficult or ambiguous cases. Most valuable for edge cases, nuanced decisions, or specific output formats. This is not necessary for simple tasks.
Keep formatting consistent. Pick a structure and stick with it throughout.
Repeat critical constraints sparingly. Reinforce only the most important rules, typically at the start and end. Over-repeating adds length and can create conflicting interpretations.
Remove redundant or unnecessary instructions. Every extra rule competes for the model's attention. If it's not adding value, it's diluting the instructions that matter.
Further reading:
Each model also has its own quirks, so consult the provider's prompt engineering guide for specifics: Google Gemini, Anthropic Claude, OpenAI GPT.
Since Tines Stories lets you choose a model per agent, test how yours responds to your prompt structure. A prompt that works on Claude may underperform on GPT. Revisit prompts whenever you switch models.
Library example
Ground your prompts with upstream data
Agents hallucinate when they're forced to guess. Use Tines Stories value pills to inject real data from upstream actions directly into the prompt or tools. This could include user context from your IdP, ticket history from your ITSM, or asset details from your CMDB. The more real context in the prompt or tool inputs, the less the model needs to infer. One of the key advantages of building agents inside Tines Stories is that the data is already flowing through the story.
Library example
Other prompt tips
Use examples (few-shot prompting) for complex classification tasks
Tell the agent what not to do — negative constraints are often as important as positive ones
Reference SOPs or documentation in the prompt to ground the agent's reasoning
3. Tines Stories AI Agent configuration options
The AI Agent action gives you several levers to control behavior, cost, and quality. It’s best to use them intentionally.
Choosing the best model for your needs
Different models have different cost/performance profiles:
Use smaller, faster models for simple classification, extraction, or summarization tasks. They're cheaper and often just as accurate for simpler jobs
Use larger, more capable models for complex reasoning, multi-step planning, or nuanced analysis
It’s best to match the model to the job. A triage agent classifying alerts into five categories can run on a smaller model; an agent writing detailed incident reports may need a larger one.
Library example
Set temperature deliberately
Temperature controls the creativity of the model's output on a scale of 0–1 (default: 0.2). The lower the value, the more focused and consistent the output; the higher the value, the more varied and creative.
Keep it low (0–0.3) for classification, extraction, structured analysis, or any task where consistency matters.
Increase it (0.4–0.7) for drafting natural language responses, summaries, or content where some variation is acceptable.
The default of 0.2 is a sensible starting point for most automation use cases. Only increase it if the task genuinely benefits from more creative output. Higher temperature also means less predictable responses, which makes downstream parsing more challenging.
Defining an output schema
Always define a structured output schema on the agent to force it to return data in a predictable format (e.g., JSON with specific keys). This is critical for multiple reasons:
It enables downstream deterministic actions or agents to reliably parse the output
You eliminate the need for fragile text-parsing logic
The agent is constrained to return only what you need, thus reducing hallucination and potential token waste
Add tools
Tools are what give an agent the ability to take action. Without them, the agent can only reason and respond. There are four types of tools you can attach to an AI Agent action:
Custom tool: a set of actions grouped together on the storyboard that the agent can invoke as a single tool that is unique to each agent.
Send to Story: a separate, reusable sub-story the agent can call to handle more complex or shared logic across stories and agents.
Templates: pre-built action templates that can be added and configured directly as tools. These are either public (pre-built and available out of the box) or private (user-created).
MCP servers: remote Model Context Protocol servers that give the agent access to capabilities hosted outside of Tines Stories without needing to build custom sub-stories.
Each tool and each input for the tool has a description field that helps give the LLM context. Clear, specific descriptions help the agent reason correctly about when and how to use each tool, and reduce the chance of it calling the wrong one.
Add skills
Tines Stories supports Agent Skills for use across agents within a team. A skill in Tines Stories is a packaged expertise in the form of a markdown file containing instructions, procedures, and domain knowledge that tells the agent how and when to approach a specific type of task. Tools extend what an agent can do; skills extend how well it does it. Similar to prompts, skills benefit from being concise and specific. Make sure to focus on domain-specific knowledge the agent doesn't already have, and use concrete examples over abstract descriptions.
4. Security and data privacy
AI agents introduce a new surface area for risk. Design defensively.
Apply least-privilege to tools
Tools available to the agent should follow least-privilege principles. If an agent only needs to read from a system, don't give it a tool that can write. Constraining tool access is one of the most effective ways to limit the blast radius of any failure, accidental or otherwise.
Scrub sensitive data before it reaches the agent
Use Event Transforms to redact or mask PII, API keys, passwords, and other sensitive data before it enters the prompt. Only send what the agent needs to reason over.
Defend against prompt injection
Prompt injection can't be fully eliminated, but it can be contained:
Limit tool permissions: if injection succeeds, the damage is bounded by what tools the agent can access.
Validate outputs before acting: add deterministic checks or human approval before high-impact actions.
Scope agents narrowly: an agent with a single, specific job has a much smaller blast radius than a broadly-capable one.
Further reading:
Audit everything
Tines Stories automatically logs all inputs, outputs, and tool calls. Tenant owners can review usage and activity across all agents in the tenant AI overview page, and export audit logs for deeper analysis. For longer-term tracking or reporting on specific decisions, consider logging key outputs to Tines Records or an external datastore.
5. When not to use AI agents
Before you ship, it's worth sense-checking your design against a few common anti-patterns. If any of these apply, simplify before you build.
The task is a deterministic lookup
If you're just checking "is this IP in a blocklist?", that's an HTTP Request, not an agent.
The logic is a glorified if/else
If the decision tree is fully known and finite, use Conditions. AI adds cost and non-determinism to a problem that doesn't need it.
When you need 100% consistency
If the exact same input must produce the exact same output every time, AI is the wrong tool. Use Event Transforms and deterministic logic.
None of this requires getting everything perfect on day one. Start with a single, well-scoped agent, apply these fundamentals, and refine as you go. The patterns here, including deterministic-first thinking, clear prompts, sensible configuration, and secure defaults, will carry you through almost any use case you build in Tines Stories.








