
Introduction
An AI agent interprets a goal, uses tools, makes decisions, and completes multiple steps on your behalf.
That power comes with risk. Gartner forecasts that over 40% of agentic AI projects will be canceled by the end of 2027, citing costs, unclear business value, or weak risk controls. This is a forecast, not a measured rate. Still, it shows that most failures come from poor scoping, not poor models.
This guide covers how agents work, when they're worth building, what components they need, how to build a first version safely, and how to choose between a custom build, an off-the-shelf product, or simpler automation.
Key Takeaways
- An agent combines a model, instructions, tools, business context, and a controlled loop.
- Start with one measurable workflow, not a general-purpose "digital employee."
- Use structured tool inputs, limited permissions, testing, and human approval for high-impact actions.
- Custom agents pay off when they work with your own systems, documents, and rules.
What Is an AI Agent, and Is It Right for Your Workflow?
An AI agent receives a goal, decides the next step, uses approved tools, observes the result, and continues until the task is done or a defined stopping point is reached. OpenAI describes a single-agent system as a model, tools, and instructions running in a loop.
How agents differ from other tools
Take a customer asking, "Can I move my Thursday appointment?"
- Chatbot: answers from general knowledge or a script, and can't touch your calendar.
- Retrieval assistant: finds your rescheduling policy and quotes it.
- Workflow automation: runs a fixed rule when a form is submitted.
- Agent: reads the request, checks availability, proposes times, updates the booking after confirmation, and hands off to staff if something is odd.
Anthropic draws the same line: workflows follow predefined code paths, while agents dynamically direct their own process and tool use.
The core agent loop
- Interpret the request and clarify the goal.
- Choose the next action.
- Call an approved tool.
- Receive the result as an observation.
- Validate the result against expectations.
- Respond, or loop again (up to a set step limit).
Is an agent the right fit?
Agents fit work with ambiguous requests, unstructured documents, changing information, multiple systems, or frequent exceptions. Common fits include:
- Customer inquiry handling that needs live lookups
- Document intake from varied or messy inputs
- Internal knowledge access across scattered systems
- Lead qualification before a human handoff
- Scheduling when availability and exceptions change
If the process is predictable, high-risk, or easy to encode, use a rule-based automation, form, API integration, or single model call instead. Gartner makes a similar split: agents where decisions are needed, conventional automation for routine work, and assistants for simple retrieval.

Run this checklist before committing:
- Business value: Does the workflow cost real time or money today?
- Error tolerance: Can a wrong answer be caught and fixed cheaply?
- Data access: Can the agent reach the information it needs, legitimately?
- Success criteria: Can you measure "done well" with a number?
Two or more "no" answers usually point to simpler automation. The Working Table makes the same call with clients: recommend AI where it pays off, and say so when it doesn't.
The Building Blocks of an AI Agent
The model
The model interprets language, selects actions, extracts information, and makes judgment calls. It should not be the source of truth for permissions, calculations, or business records. Those belong in application code and databases.
Tools
Tools are controlled functions that let the agent retrieve data or act. Examples include search, CRM lookup, document retrieval, calendar access, email drafting, database updates, and handoffs to staff.
Separate them by risk:
- Read-only tools fetch information and change nothing.
- Write tools change records or trigger external effects, so they need tighter limits and often approval.
Instructions
Instructions define the agent's role, objectives, boundaries, tone, escalation rules, and completion criteria. Don't start from scratch. Convert existing policies, standard operating procedures, and support documentation into clear, step-based instructions.
Context and knowledge retrieval
Give the agent only what's relevant at each step. Anthropic recommends keeping context informative but tight, retrieving at runtime rather than loading everything in advance. When answers depend on company documents, add a knowledge base with retrieval. Never hand over an unrestricted dump of company data.
Runtime and controls
The runtime layer wraps the model with safeguards: structured outputs, input validation, authentication, authorization, rate limits, step caps, error handling, audit logs, and human approval before sensitive actions.
A simple flow:
User request
-> Input checks (validation, filtering)
-> Model chooses action
-> Application validates arguments and permissions
-> Tool runs (read-only, or write with approval gate)
-> Result returns to model as observation
-> Output check -> Respond, loop, or hand off to a person
(Every step logged; max-step limit enforced)
How to Build an AI Agent Step by Step
1. Identify a narrow workflow and define success
Pick one repetitive but valuable process. Document how employees do it today, including the decisions and exceptions. Then set a measurable outcome: faster response, fewer manual handoffs, more complete records, or easier access to information.
Keep it narrow enough to test end to end, yet meaningful enough to show business value. Appointment requests for one service line beat "all customer communication."
2. Map data, systems, users, and permissions
List what the agent needs, where it lives, who may access it, which systems must connect, and which actions need approval. Flag sensitive customer, employee, financial, health, or confidential data.
Do this data-flow and permissions review before choosing a model or framework. Real system constraints should shape the build, not a generic demo.
3. Choose a build path
| Path | Best for | Tradeoff |
|---|---|---|
| Direct model API | Maximum control | More engineering and upkeep |
| Agent framework (OpenAI Agents SDK, Microsoft Agent Framework, Google ADK, LangGraph) | Stateful, multi-step logic | Learning curve, framework dependence |
| Low-code platform (such as Copilot Studio) | Speed, common integrations | Less flexibility, vendor lock-in |
| Development partner | Limited internal capacity | Needs a partner who understands your operations |
OpenAI recommends setting a baseline with the most capable model, then testing smaller models for cost, latency, privacy, or reliability. Check current options rather than assuming one vendor wins everywhere.
4. Design tools and structured outputs
Every tool needs a clear name, purpose, input schema, expected output, permissions, failure behavior, and examples of valid and invalid use. The model should request structured parameters, not write unrestricted database queries or run arbitrary code.
Apply least privilege:
- Grant only the access the workflow needs.
- Separate read and write operations.
- Validate arguments in application code.
- Require confirmation for irreversible or high-impact actions.
5. Write instructions, context, and stopping conditions
Specify the role, task sequence, allowed tools, source-of-truth systems, escalation rules, handling of missing information, and what counts as success or failure.
Add limits for maximum turns, retries, duplicate actions, contradictory data, unavailable tools, uncertain answers, and out-of-scope requests. A handoff might read:
"I can't confirm that refund. I've sent your request and the details we discussed to our billing team, and someone will follow up today."
6. Prototype, evaluate, and improve
Build a small end-to-end version and test it on realistic inputs:
- Normal requests
- Incomplete information and ambiguous wording
- Adversarial prompts
- Permission failures and incorrect records
- Tool outages
Track task completion, factual accuracy, tool-selection accuracy, escalation quality, latency, cost, and user satisfaction. OpenAI's evaluation guidance uses traces of tool calls, guardrails, and handoffs to check whether the right tool was used and policy was followed.
Then refine instructions, tools, data access, or the workflow based on observed errors.

Orchestration, Safety, Testing, and Deployment
Start with one agent
OpenAI recommends starting with a single agent and adding tools incrementally, with handoffs as an option. Add routing, specialized workers, or manager-and-worker patterns only when tool overlap, complex branching, or prompt bloat creates a clear need. Multiple agents aren't inherently better.
Layer your safety controls
OWASP's 2025 Top 10 for LLM applications lists prompt injection and excessive agency among its top risks. Build in layers:
- Input filtering and prompt-injection defenses
- Output validation
- PII handling rules
- Risk ratings for each tool
- Authentication and authorization
- Approval gates and human handoffs
Guardrails supplement normal application security. They don't replace it.
Treat production as an operating process
- Deploy in a sandbox or limited pilot first.
- Monitor success and failure patterns.
- Let staff interrupt or override the agent.
- Retest after any model or prompt change.
- Name an owner for maintenance, policy updates, and incident response.
The Working Table's delivery process (Discover, Design, Deploy, Support) follows this pattern, with training, monitoring, and refinement after launch.
Business Decisions Before You Build
What drives cost
Costs come from discovery and workflow design, model usage, data preparation, integrations, interface development, security review, testing, deployment, monitoring, and maintenance. Provider pricing is per million tokens, and repeated model and tool calls multiply usage.
Check the current rate cards from OpenAI, Anthropic, and Google, and separate prototype costs from production ownership costs. No universal project price exists.
Which option fits
| Factor | General AI tool | Embedded app feature | Custom agent | Conventional automation |
|---|---|---|---|---|
| Workflow fit | Broad, shallow | Within one product | Tailored | Fixed rules |
| Company data access | Limited | Product data only | Your systems | Defined integrations |
| Customization | Low | Low to medium | High | Medium |
| Support burden | Low | Low | Higher | Low to medium |
Choose by volume, privacy needs, integration requirements, internal support capacity, and the consequences of errors.
Local versus cloud
Local models offer more data control, but they need hardware (Ollama's documentation lists specific GPU requirements), ongoing maintenance, and your own integrations and updates. Cloud models are typically more capable and easier to run. Local operation does not automatically make an agent secure or legally compliant.

Getting help
The Working Table helps small and midsize organizations pick a practical first workflow, build a custom agent around their processes and data, and support training and ongoing improvement. Engagements have no minimum spend and no long-term contracts.
Responsible US adoption
Before launch, review these with qualified legal or compliance professionals:
- Privacy obligations (state laws such as California's CCPA rules, effective January 1, 2026)
- Contracts and vendor terms
- Intellectual-property and licensing questions
- Sector rules such as HIPAA or the FTC Safeguards Rule
- Employment considerations, since the EEOC says existing antidiscrimination laws apply to AI
- Records retention and customer disclosures
Frequently Asked Questions
How much does it cost to build an AI agent?
It depends on workflow complexity, model usage, integrations, data preparation, security, testing, and ongoing support. Scope a focused prototype first, then request a production estimate.
How are AI agents being built?
Teams combine a language model, instructions, tools, business data, an execution loop, structured outputs, guardrails, and evaluation. They build with APIs, frameworks, low-code platforms, or development partners.
Which AI agent is best for small business?
No single agent wins. Choose by workflow, existing software, data permissions, budget, support needs, and tolerance for errors.
Can I run an AI agent locally?
Yes, using local models and runtimes such as Ollama or llama.cpp. Expect tradeoffs in hardware, maintenance, integrations, and performance. Local hosting is only one part of responsible deployment.
Is it legal to build your own AI?
Generally yes, but legality depends on data sources, privacy, intellectual-property rights, contracts, sector regulations, automated decisions, and use. Get legal review for material risks.
What are custom AI agents?
They are agents built around a specific organization's workflows, tools, rules, knowledge, data, and approval process, not just generic prompts.