Guardrails, agents and token budgets
Guardrails and untrusted content
Bedrock Guardrails can apply configurable content, sensitive-information, topic, prompt-attack and grounding checks, depending on supported features and configuration. Guardrails reduce risk but do not guarantee correctness, safety, privacy or authorization. Retrieved documents and tool output are untrusted data, even if they look like instructions. Keep instruction hierarchy separate, enforce access in application code and validate every tool request independently. Never depend on a keyword filter alone; test benign and adversarial examples in a controlled synthetic environment.
Agents and AgentCore
An agent selects actions based on a goal, model outputs and observations. Amazon Bedrock Agents Classic is closed to new customers as of July 30, 2026; existing deployments should review the documented migration paths. Amazon Bedrock AgentCore offers components such as Runtime for hosting agent workloads, Gateway for exposing tools and Identity for workload identities. Gateway policy controls and runtime roles are complementary, not substitutes for application authorization. Verify current component availability and identity propagation for the selected protocol. An agent’s proposed refund is not permission to issue one. Bind the real user identity, allowed operation, resource and validated parameters to the tool boundary; require explicit human approval for consequential writes.
Tokens, throughput and cost
For an illustrative text model charging per 1,000 tokens, multiply input and output token totals by their respective unit rates. Suppose one request uses 1,200 input and 300 output tokens at invented rates $0.002 and $0.006 per thousand: cost is $0.0042; 100 such requests cost $0.42. These are not AWS prices. Include embeddings, retrieval storage, reranking, guardrails, evaluation, agent hosting and network charges. On-demand, batch and provisioned throughput options vary by model; capacity is not unlimited. Set maximum input/output tokens, request count, retry count, agent steps, time and concurrency; reserve worst-case cost before starting a step. Budget alerts do not enforce a hard limit.
Fail closed and review
In the lab, permit a read only for an authenticated user and accessible resource; a refund additionally requires role permission and approval. Unknown tools, invalid parameters, absent evidence or exhausted budgets stop the workflow. Store minimal audit metadata such as decision, model version, latency and token count, not raw confidential prompts. For optional authorized cloud work, verify current rates, use synthetic documents, enforce limits and remove unused knowledge bases, indexes, agents, runtime and logs according to retention rules. The mock budget below models only token charges and cannot control an AWS bill.
{ "max_input": 1200, "max_output": 300, "max_requests": 100, "max_steps": 100, "max_retries": 2, "max_cost": "0.42", "input_rate": "0.002", "output_rate": "0.006"}Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Guardrails, agents and token budgets — knowledge check
Reason about inference contracts, grounded answers and bounded agent actions.
What is a suitable option to evaluate for new agent projects?
Where must consequential tool authorization occur?
What is the hypothetical token cost of 100 requests at $0.0042 each?
What does a guardrail pass establish?
What should happen when the step budget is exhausted?