AWS Public Sector Blog
Building AI agents for domain-specific classification at scale

Organizations across industries face a common challenge: transforming unstructured, domain-specific data into standardized classifications while maintaining accuracy, auditability, and compliance. Whether it’s criminal charges in law enforcement, medical diagnoses in healthcare, or regulatory codes in financial services, manual classification is time-consuming, error-prone, and difficult to scale.
This post shows how public sector and enterprise teams can build an agentic AI-powered classification system on Amazon Web Services (AWS) using the Strands Agents SDK, Amazon Bedrock, and serverless services. You will learn the architecture, the agent workflow, and how to implement this system using the Strands Agents SDK. The approach uses agentic reasoning and web-grounded validation to produce explainable classifications backed by authoritative source citations, reducing manual effort, improving consistency, and creating a complete audit trail for compliance.
Challenges
Establishing effective classification systems for domain-specific data requires substantial effort and expertise. Traditional approaches rely on manual review, static rule engines, or basic machine learning models that lack contextual awareness. This creates significant challenges.
- Understanding classification logic means reviewing code or documentation: Each system implements its own approach, leading to inconsistency and redundant effort across teams.
- Classification rules couple tightly to application code and are difficult to adapt: This makes updates painful as regulations evolve and limit flexibility when expanding to new standards or jurisdictions.
- Auditing and governance are fragmented: Teams don’t centralize reasoning or make it transparent, making it difficult to track who changed what classification logic and when.
- It’s time-consuming: Significant development effort is required for each new classification domain or jurisdiction.
- As data volumes grow, monolithic classification components become performance bottlenecks.
Solution
To address these challenges, the architecture uses an agentic AI classification system built with the Strands Agents SDK and Amazon Bedrock. The Strands Agents SDK is an open-source framework that enables developers to build AI agents capable of multi-step reasoning and autonomous tool use with just a few lines of code. Amazon Bedrock provides access to foundation models that power the agent’s reasoning. Together, they enable a system where each classification isn’t only a lookup but an autonomous reasoning task: the agent analyzes input, researches authoritative sources, synthesizes a decision, and documents its rationale with citations.
To operate at scale, the agent runs within AWS Lambda, with Amazon Simple Queue Service (Amazon SQS) managing asynchronous batch processing and Amazon DynamoDB persisting every classification with its full reasoning trail. A web search API grounds each classification in authoritative public sources such as statutes, regulations, and official guidelines. Teams that prefer a fully controlled knowledge corpus can replace the web search component with AWS retrieval services such as Amazon Bedrock Knowledge Bases.
The following diagram shows how the system simplifies classification with decentralized, context-aware AI agents. Each component handles a specific responsibility, from ingestion to reasoning to audit persistence.

Figure 1: Domain-specific classification with agentic AI and web-grounded reasoning
- A producer uploads a CSV file (or sends a single record) to an Amazon Simple Storage Service (Amazon S3) input bucket.
- Amazon EventBridge reacts to the object-created event and triggers a splitter Lambda function that batches records and enqueues them to Amazon SQS.
- The processor Lambda function consumes batches from Amazon SQS and invokes the Strands agent for each record. The agent, running on Lambda, calls Amazon Bedrock for foundation model inference.
- The agent uses the classification context provided (domain rules, jurisdiction, and temporal parameters) and calls a web search tool to retrieve authoritative sources (statutes, regulations, and official guidelines), then synthesizes a classification with reasoning and citations.
- The agent writes the result, including confidence score and source URLs, to DynamoDB; an optional S3 export bucket stores reports for downstream systems.
- Amazon CloudWatch captures token metrics and OpenTelemetry traces for full agent observability, including reasoning steps, tool invocations, model latency, and cost tracking.
Use cases
This agentic classification approach applies to multiple industries. Organizations across the public sector and regulated industries can use these autonomous agents to standardize domain-specific data at scale:
- Law enforcement agencies can classify free-text criminal charges into standardized offense codes (such as those used in national incident-based reporting) for consistent reporting across jurisdictions, with citations to the underlying statutes.
- Healthcare organizations must map clinical diagnoses and procedures to ICD-10 and CPT codes for billing and compliance. The agent can analyze physician notes, procedure descriptions, and patient context to suggest appropriate codes with confidence scores, flagging ambiguous cases for human review.
- Financial services firms need to classify transactions into regulatory reporting categories (SAR, CTR) based on transaction patterns, amounts, and contextual factors. The system can autonomously research regulatory guidance and apply jurisdiction-specific rules.
- Transportation agencies require classification of incident reports into standardized categories for safety analysis and federal reporting. The agent can process narrative descriptions and classify incidents with references to relevant safety standards.
Agent workflow: From input to decision
The system uses structured prompts and tool definitions to guide the AI agent’s reasoning process. Each classification request follows a sophisticated multi-step workflow:
At the core of every classification lie several critical components:
1. Input context
All available information about the item being classified.
| Field | Description |
|---|---|
| Primary data | The text or description requiring classification. |
| Domain context | Geographic location, applicable regulations, industry standards, or domain-specific codes. |
| Temporal context | Date, time, or period relevant to classification rules. |
| Metadata | Additional attributes that influence classification decisions. |
2. Reasoning process
The agent follows a structured approach.
- Analyze: Examine input data and identify key classification indicators.
- Research: Search for authoritative sources, statutes, or standards.
- Synthesize: Combine information from multiple sources to determine the classification.
- Validate: Assess confidence based on source quality and completeness.
- Document: Generate detailed reasoning with citations.
- The agent can also draw on reasoning from prior classifications to guide its research on similar inputs, improving consistency over time and reducing redundant source lookups.
3. Output
Each classification includes the following fields.
| Field | Description |
|---|---|
| Code | The standardized code or category. |
| Description | Human-readable name of the classification. |
| Confidence | Numerical value (0.0–1.0) indicating certainty. |
| Reasoning | Detailed explanation citing specific sources. |
| Citations | URLs and references to authoritative sources. |
| Review flag | Flag set when confidence is below threshold (for example, 0.60). |
Implementing the agent with the Strands Agents SDK
The agent is concise. With the Strands Agents SDK, the team defines a system prompt that encodes the classification policy, registers a set of tools, and lets the agent loop until it produces a structured result. The following snippets are illustrative reference code.
Defining a tool for authoritative source lookup:
from strands import Agent, tool
from strands.models import BedrockModel
@tool
def web_search_statute(query: str, max_results: int = 3) -> str:
"""Search authoritative sources for classification decisions."""
results = search_client.search(query=query, max_results=max_results)
return json.dumps([
{"title": r["title"], "url": r["url"], "snippet": r["content"][:500]}
for r in results.get("results", [])
])
Creating the agent with a Bedrock-hosted foundation model:
model = BedrockModel(
model_id="us.anthropic.claude-sonnet-4-6-20250929-v1:0",
region_name="us-east-1",
temperature=0.1,
)
agent = Agent(
model=model,
tools=[web_search_statute],
system_prompt=get_classification_prompt(),
)
Invoking the agent on a single record:
request = {
"charge_text": "DWI 2nd Offense",
"state": "CA",
"statute_code": "23152",
"offense_type": "Misdemeanor",
}
response = agent(json.dumps(request))
classification = json.loads(response.message)
Sample classifications
The following examples show how the agentic classification system handles real-world inputs using synthetic data. Each diagram shows the input, the agent reasoning process, and the structured output.
- Law enforcement – criminal charge classification: Law enforcement agencies receive criminal charges in varied formats from different jurisdictions. The agent normalizes these into standardized offense codes regardless of wording or jurisdiction, as shown in the following figure.
Figure 2: Multiple charge descriptions from different states normalize to the same offense code through independent agent invocations
- Healthcare – diagnosis code mapping: Healthcare providers need to map clinical notes to ICD-10 codes. The agent parses clinical indicators, searches coding guidelines, and produces a classification with confidence scoring, as shown in the following figure.
Figure 3: Clinical note classification showing input, agent reasoning, and structured ICD-10 output
- Financial services – transaction classification: Financial institutions must identify suspicious transaction patterns for regulatory compliance. The agent analyzes patterns, researches FinCEN guidance, and determines regulatory actions, as shown in the following figure.
Figure 4: Transaction pattern classification showing input, agent reasoning, and regulatory output
Next steps
Agentic AI classification shifts domain-specific data processing from brittle rule engines to autonomous, explainable reasoning. The architecture described here delivers:
- Transparency: every classification includes detailed reasoning and source citations
- Adaptability: the agent autonomously researches evolving statutes and regulations
- Scalability: serverless components handle variable workloads efficiently
- Governance: a full audit trail captures every decision and the reasoning behind it
- Quality: confidence scoring and human-in-the-loop review let teams calibrate accuracy to their risk tolerance
To get started:
- Explore the Strands Agents SDK on GitHub to build AI agents.
- Review the Amazon Bedrock documentation to learn about accessing foundation models.
- Visit the AWS Public Sector page or contact your AWS account team to evaluate this architecture for your organization.


