Agent-Centric Applications
In an agent-centric application, agents carry the core of the workflow: they decide which steps to take, which systems to query and which actions to prepare. The rest of the application (user interface, APIs, data, integrations) exists to give agents context, tools and boundaries, and to let people supervise them.
Building a convincing demo of such an application takes days. Running it in production, for real users, with real data and real consequences, takes much more. Agents differ from traditional software in ways that affect every operational concern:
| Traditional application | Agent-centric application |
|---|---|
| Deterministic: same input, same output | Non-deterministic: the same request can take different paths |
| Code paths reviewed before release | Paths chosen at runtime by the model |
| Behavior changes when code changes | Behavior also changes with prompts, models, tools and data |
| Fixed cost per request | Variable cost: depends on how many steps the agent takes |
| Errors are exceptions | Errors include plausible but wrong answers and wrong actions |
| Inputs come from users and systems | Inputs also come from documents and tool results, which may contain hostile instructions |
This page lists the concerns to address before deploying agent workflows to production, using Langfuse as an example platform for observability, prompt management and evaluation.
Overview of concerns
| Concern | Key question |
|---|---|
| Security | Can the agent be tricked or misused into doing harm, leaking data, or exceeding its authority? |
| Observability | Can we see exactly what the agent did, why, and at what cost? |
| Quality assessment | How do we know the agent does the job well, and stays good after changes? |
| Prompt and configuration management | Which prompt, model and tool versions are running, and can we roll back? |
| Cost and performance | Is spend predictable and latency acceptable? |
| Reliability | What happens when a tool, model or step fails in the middle of a task? |
| Human oversight | Where do people approve, correct or take over? |
| Change management | How do we safely change models, prompts and tools? |
| Governance and compliance | Can we explain, audit and justify what the agent does? |
Reference stack
The agent and the LLM gateway send traces to an observability platform. Prompts are loaded from a versioned prompt store instead of being hard-coded. Evaluations run on traces and datasets, and their findings drive the next changes.
Security
Agents combine the risks of web applications with new ones: they act on behalf of users, read untrusted content, and decide by themselves which tools to call. The OWASP Gen AI Security Project, including its Agentic Security Initiative, describes these risks in detail.
| Area | Practices |
|---|---|
| Identity and authorization | The agent acts on behalf of the signed-in user, with that user's permissions, never with a broad technical account. Every tool call is authorized against the user's rights (see identity and access management) |
| Least-privilege tools | Only the tools the agent's task needs; read-only where possible; narrow, task-oriented tools instead of generic "run any query" tools |
| Approvals for consequential actions | Payments, deletions, external emails and production changes require explicit human confirmation, enforced by the harness or a policy engine, not only by the prompt |
| Prompt injection | Treat documents, emails, web pages and tool results as untrusted data. Separate instructions from data, restrict what the agent can do after reading untrusted content, and validate outputs before acting on them |
| Sandboxing | Code execution, file handling and browsing run in isolated environments without access to production networks or credentials |
| Secrets | Credentials stay in a secrets manager and are injected by the harness or gateway at call time. They never appear in prompts, context or traces |
| Data protection | Classify which data the agent may see; mask personal data where it is not needed, including in logs and traces; respect data residency and retention rules |
| Supply chain | Review and pin MCP servers, tools, frameworks and models like any other dependency (see MCP and security) |
| Audit trail | Record who asked for what, what the agent did, which tools it called with which inputs, and who approved it |
Instructions in the system prompt ("never delete records") are not a security control. Enforce limits in code: in tool permissions, policy checks and approval steps that the model cannot bypass.
Observability
Observability for agents goes beyond the usual metrics and logs of platform observability. Engineers need to see the full path of each task: every model call, tool call and retrieval, with inputs, outputs, timing and cost.
What to capture
The usual structure is a hierarchy of sessions, traces and observations (spans):
Session: support conversation with customer C-1042
└── Trace: "Why was I charged twice?" 12.4 s $0.084
├── Generation: plan next step (model X) 1.8 s 2,140 tokens
├── Tool: billing.get_payments(customer=C-1042) 0.6 s
├── Retrieval: refund policy (top 5 chunks) 0.3 s
├── Generation: analyze payments (model X) 3.1 s 5,870 tokens
├── Tool: billing.prepare_refund(amount=49.00) 0.4 s awaiting approval
└── Generation: answer to customer (model X) 2.2 s 1,320 tokens
| Data | Why it matters |
|---|---|
| Inputs and outputs of each step | Debugging wrong answers and wrong actions |
| Model, parameters, prompt version | Linking behavior to configuration |
| Tokens, cost, latency per step | Finding expensive or slow steps; attributing cost |
| Tool calls with arguments and results | Understanding what the agent actually did |
| User, session, tenant, environment | Filtering, support cases, cost per customer |
| Errors and retries | Reliability analysis |
| Scores and feedback | Connecting quality to individual traces |
Standards help: OpenTelemetry defines semantic conventions for generative AI, so traces from different frameworks and tools can be collected the same way.
Example: Langfuse
Langfuse is an open source platform for observing, evaluating and improving LLM and agent applications. It can be used as a cloud service or self-hosted, which matters when traces contain sensitive data. For observability it provides:
- Tracing of LLM calls, tool calls, retrievals and other steps, through native SDKs, many framework integrations, and OpenTelemetry
- Sessions and user tracking for multi-turn conversations and per-user analysis
- Cost and latency analysis per trace, user, model and feature
- Masking of sensitive data before it is stored
- Gateway integration, for example with the LiteLLM proxy, so model traffic is traced centrally
Agent traces should also feed the organization's general observability: error rates, latency and cost as metrics with alerts, alongside the rest of the system.
Quality assessment
The question "does it work?" has no simple answer for agents. Quality must be measured continuously, before and after release.
What to measure
| Level | Example metrics |
|---|---|
| Outcome | Was the task completed correctly? Was the user's problem solved? |
| Answer quality | Correctness, faithfulness to sources, relevance, tone, format |
| Trajectory | Were the right tools called, with the right arguments, in a reasonable number of steps? |
| Safety | Policy violations, data leakage, unauthorized actions attempted |
| Efficiency | Steps, tokens, cost and time per completed task |
How to measure
| Method | When | Description |
|---|---|---|
| Offline evaluation on datasets | Before release, in CI | Run the agent on a curated set of realistic tasks with expected outcomes; compare versions |
| Code-based checks | Always | Deterministic assertions: valid output format, correct tool called, no forbidden action |
| LLM-as-a-judge | Offline and on production samples | A model grades outputs against a rubric, such as faithfulness or helpfulness; calibrate it against human judgments |
| Human annotation | Regularly, on samples | Experts review and score traces; their labels improve datasets and judges |
| User feedback | In production | Thumbs up or down, corrections, accepted or rejected suggestions, linked to traces |
| Online experiments | Release | Compare versions on real traffic, for example in a canary or A/B test |
Langfuse supports this loop with datasets and experiments, LLM-as-a-judge evaluators that can score production traces automatically, and manual scoring for human review, all linked to the same traces (see the evaluation overview). Tools such as promptfoo and Ragas complement it for test suites and RAG-specific metrics.
Every production failure is a test case. When a trace shows a wrong answer or action, add it to the evaluation dataset, so the same mistake is caught before the next release.
Prompt and configuration management
An agent's behavior is defined by more than code: system prompts, tool descriptions, model choice and parameters all change it.
- Version prompts outside the application code, with labels such as
productionandstaging, so they can be updated and rolled back without a redeploy. Langfuse prompt management is one example. - Link every trace to the versions used (prompt, model, tools), so quality changes can be traced to configuration changes.
- Review prompt changes like code changes, and run evaluations before promoting them.
- Pin model versions and treat model upgrades as releases.
Cost and performance
| Practice | Description |
|---|---|
| Limits per task | Maximum steps, tokens, time and cost per task, with defined behavior when a limit is reached |
| Budgets per team and tenant | Enforced in the LLM gateway, for example with LiteLLM virtual keys |
| Model per step | Smaller, faster models for simple steps (classification, routing); the most capable models for hard reasoning |
| Caching | Prompt caching for stable instructions and context; caching of tool results where safe |
| Context hygiene | Concise tool results; summarizing or clearing old context in long tasks |
| User experience | Streaming and progress updates, so long tasks do not feel stuck |
| Cost monitoring | Cost per completed task, per feature and per customer, with alerts on anomalies |
Reliability
Agent tasks can run for minutes or hours and touch many systems. Failures in the middle of a task must not leave things half done.
- Timeouts and retries for model and tool calls, with backoff and fallbacks to alternative models through the gateway.
- Idempotent tools, so a retried step does not create a second refund or a duplicate ticket.
- Durable execution for long-running work: persist the agent's state at each step, so tasks survive restarts and can resume. Workflow engines such as Temporal or AWS Step Functions, or the session features of agent platforms, provide this.
- Graceful degradation: a clear message, a fallback to a simpler process, or a handover to a human when the agent cannot continue.
- Kill switch: the ability to stop an agent, a tool or a feature immediately, without a deployment.
Human oversight
- Approval points for consequential or irreversible actions, with all the information needed to decide.
- Escalation: the agent hands over to a person when it is uncertain, when the user asks, or when limits are reached.
- Transparency: users see what the agent did and on which sources and data it based its answer.
- Correction: people can edit, reject or undo the agent's proposals, and their corrections become feedback for evaluation.
Change management
Models, prompts, tools and data change often, and each change can alter behavior in unexpected ways.
- Run the evaluation suite on every change: prompt, model, tool, retrieval or framework version.
- Release gradually with feature flags, canaries or A/B tests, comparing quality, cost and latency between versions.
- Keep the previous configuration ready for immediate rollback.
- Watch provider announcements for model deprecations, and plan migrations ahead of retirement dates.
Governance and compliance
- Inventory: register each agent with its owner, purpose, tools, data access and risk level in the architecture repository.
- Risk classification under regulations such as the EU AI Act, with documentation, human oversight and logging proportional to the risk.
- Retention rules for traces and conversations, which often contain personal data.
- Accountability: clear ownership for each agent's behavior, its quality and its incidents.
Observability and evaluation platforms
| Platform | Notes |
|---|---|
| Langfuse | Open source; tracing, prompt management, evaluation; cloud or self-hosted |
| LangSmith | Tracing and evaluation from the LangChain team; works with other frameworks too |
| Arize Phoenix | Open source observability and evaluation, based on OpenTelemetry |
| Braintrust | Evaluation-centric platform with tracing and experiments |
| MLflow Tracing | Tracing and evaluation within the MLflow platform |
| Datadog LLM Observability | Agent observability inside an existing Datadog setup |
| Cloud platform services | For example AgentCore Observability and Evaluations on AWS (see agents) |
Prefer platforms that accept OpenTelemetry data. Instrumentation then stays independent of the platform, and traces can also flow into the organization's general observability tools.
Production readiness checklist
- The agent acts with the user's permissions; tools follow least privilege
- Consequential actions require approval enforced outside the prompt
- Untrusted content cannot trigger actions without validation
- Every model and tool call is traced, with user, session, versions, tokens and cost
- Sensitive data is masked in traces; retention is defined
- An evaluation dataset of realistic tasks exists and runs on every change
- Production traces are scored by automated judges, user feedback and human review
- Prompts and configurations are versioned and can be rolled back
- Limits and budgets per task, user and tenant are enforced
- Tools are idempotent; long tasks survive restarts
- Escalation to humans and a kill switch exist
- The agent is registered with an owner, purpose and risk classification