Skip to main content
A
Docs

Agents

Build, deploy, and manage autonomous AI agents for government workflows with tool calling and execution tracing.

Overview

Anar Agents is a government agentic AI platform for building, deploying, and managing autonomous AI agents. Each agent has a system prompt, a set of tools it can call, configurable reasoning limits, and full execution tracing for audit and accountability.

Government workflows — permit processing, citizen inquiries, document review — involve multi-step reasoning that traditional chatbots cannot handle. Agents solves this by giving each AI agent the ability to reason through steps, call tools to gather information, and arrive at accurate answers with a complete audit trail.

Key Capabilities

Tool-Calling Agent Runtime

The core runtime executes a reasoning loop: the LLM decides which tool to call, executes it, observes the result, and repeats until it has enough information to answer. Each agent is configurable with a maximum step count to prevent runaway execution.

Pre-Built Government Agents

Ship with three production-ready agents tailored for GCC government use cases: Citizen Inquiry, Document Review, and Permit Processor. Each comes with domain-specific tools and system prompts ready for deployment.

Execution Tracing

Every agent run produces a step-by-step trace showing the LLM's reasoning, tool calls, tool responses, and final output. Traces are persisted and queryable, providing the audit trail required for government AI deployments.

Global Executions View

A cross-agent execution history page shows all runs across every agent, with filtering by status, agent, and date range. This provides a unified audit view of all agent activity.

Batch Operations

Delete multiple agents or runs in a single operation for efficient cleanup and management of agent resources.

Interactive Playground

The playground provides a chat interface for testing agents in real time. Select an agent, send messages, and observe the tool-calling loop live — ideal for development, QA, and stakeholder demos.

Architecture

Agents uses a FastAPI backend on port 8005 with a Next.js dashboard on port 3005. The agent runtime is powered by Groq LLMs with function calling support, using llama-3.3-70b-versatile as the default model.

The runtime manages:

  • Agent registry — Create, list, update, and delete agent definitions
  • Execution engine — Run agents with input, track steps and token usage
  • Session management — Maintain conversation state across playground interactions
  • Metrics collection — Success rates, latency, token consumption per agent

SSE Streaming

Agent runs support Server-Sent Events for real-time step-by-step output. Clients can observe tool calls and reasoning as they happen, rather than waiting for the complete response.

Quick Start

cd agents/backend
uv sync
uv run uvicorn anar_agents.main:app --reload --port 8005

Create an agent:

curl -X POST http://localhost:8005/api/v1/agents \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Visa Inquiry Agent",
    "description": "Handles visa-related questions",
    "system_prompt": "You are a government visa services assistant.",
    "model": "llama-3.3-70b-versatile",
    "tools": ["lookup_service", "check_application_status"]
  }'

Dashboard

The Agents dashboard provides five views:

  • Overview — Agent count, total runs, aggregate success rate
  • Agents — Full CRUD management for agent definitions
  • Traces — Step-by-step execution trace viewer with tool call details
  • Playground — Interactive chat for testing agents
  • Metrics — Performance charts for latency, token usage, and success rates

Observability

Agents is instrumented with OpenTelemetry via anar_shared.setup_otel(). When OTEL_EXPORTER_OTLP_ENDPOINT is set, traces, logs, and metrics are exported to the OTel Collector.

MCP Server

Agents exposes a Model Context Protocol server at /mcp via FastApiMCP, enabling AI assistants to create agents, trigger runs, and query execution traces programmatically.

Gateway Integration

When GATEWAY_URL is set, all agent LLM calls route through Anar Gateway for unified cost tracking and safety scanning.

Test Suite

251 tests cover agent CRUD, execution runtime, tool calling, tracing, sessions, metrics, global executions, batch operations, and execution filtering.

cd agents/backend && uv run pytest

Next Steps