Skip to content

Build an assured agent

This section builds a real agent, start to finish, the way you would build your own: the screening agent of the Brutor Demo System. It pre-screens consumer loan applications for a fictional EU lender, Borealis Consumer Finance AB. Creditworthiness evaluation of natural persons is high-risk under the EU AI Act (Annex III 5(b)), so it is a good test of whether an agent can be assured, not just governed: every decision it records has to be explainable, overseen by a human where it matters, and backed by evidence someone else can check.

The pages follow the agent’s code. Each one shows the piece of the agent it covers, the gateway configuration that piece depends on, and what the platform does with it.

every 10 min: one tick, then one run per application
┌──────────────────────────────────┐
│ brutor-demo-screening-agent │ LangGraph, 8 nodes, no loop
│ AI System: Brutor Demo System │ ◀── this section: the agent code
└────────────────┬─────────────────┘
│ API key bound to the agent identity
│ + run / step / turn / release / outcome headers
▼
┌──────────────────────────────────────────────────────────────────────┐
│ Brutor Core Proxy :8100 │
│ /v1/proxy/llm/chat/completions → gpt-5.2 (classify) │
│ /v1/proxy/llm/responses → gpt-5.5 (decide) │
│ /v1/proxy/mcp/{applications} → Loan Applications MCP server ┐ │
│ /v1/proxy/mcp/{bureau} → Credit Bureau MCP server ├─ given:
│ /v1/proxy/mcp/system-agent-skill-server-default → affordability │ registered,
│ /v1/proxy/a2a/outbound → Fraud Screener agent (A2A) ┘ not written
│ grants · guardrails · argument policy (approval) · limits · run caps│
│ run ledger · drift · contract · sealed evidence │
└──────────────────────────────────────────────────────────────────────┘

In scope: the agent itself, the gateway client it talks through, and the configuration each capability needs: registering the two MCP servers, publishing and granting the skill, registering the fraud screener’s agent card, and the governance and assurance settings around the agent.

Not in scope: the code of the MCP servers, the skill script and the fraud screener. They ship ready-made in the repository; you register them and call them. If you need to build your own MCP server, see Register your own MCP server; for authoring skills, see Agent Skills; for the remote side of A2A, see A2A agents.

One run is one loan application. The graph is linear, and every node makes exactly one governed call:

# Node Gateway call What it decides
1 intake MCP applications_get Loads the application
2 verify_identity MCP bureau_verify_identity verified=false forces refer
3 credit_report MCP bureau_get_report Sensitive read, sealed as evidence
4 affordability Skill affordability-check via skills__run_script unaffordable forces decline
5 classify LLM gpt-5.2, JSON output Risk band low / medium / high
6 fraud_screen A2A to the Fraud Screener hit forces decline, review forces refer
7 decide LLM gpt-5.5, JSON output Recommendation, rationale, customer letter
8 record MCP applications_set_recommendation Closes the run with its declared outcome

A decline, or any loan above 25,000 EUR, is held for a human underwriter by the gateway before it is recorded. The agent handles the hold, and applies the underwriter’s decision on a later tick.

There is no access check, no PII filter, no budget counter and no audit logger in the agent. Those come from the gateway, because every call points at it. What the agent does contain is the small amount of code that only the agent can write, because only it knows the facts:

  • Which calls are one task. One x-brutor-run-id per application.
  • Which phase a call belongs to. Step and turn headers.
  • Which release is calling. X-Brutor-Agent-Name / -Version / -Build.
  • How the task ended. X-Brutor-Run-End and a declared X-Brutor-Outcome-Id.
  • What to do when a human must decide. Handle 202 approval_required.
  • Whose fault a failure was. The application’s, or the system’s.

Those few facts are what turn governed traffic into an assured AI System: a run ledger, baselines, drift with causes, a contract and an assurance report.

  1. Start the trial bundle (Quickstart). The demo needs the Control Plane on :5050, the Core Proxy on :8100 and the Docker network brutor-network.

  2. Clone the demo and bring it up. demo.sh up builds the MCP servers and the fraud screener, provisions everything this section describes with setup.py, and starts the screening agent:

    Terminal window
    git clone https://github.com/brutor-ai/brutor-demo-system.git
    cd brutor-demo-system/brutor-demo-setup
    cp .env.example .env # set OPENAI_API_KEY
    python3 -m venv .venv && source .venv/bin/activate
    python -m pip install -r requirements.txt
    ./demo.sh up
  3. Watch it: ./demo.sh logs screening-agent, then AI Estate → AI Systems → Brutor Demo System → Runs in the Admin UI (http://localhost:3002, admin / Admin123!).

The repository layout the pages refer to:

brutor-demo-system/
├── brutor-demo-screening-agent/ ← the agent this section builds
│ └── screening_agent/
│ ├── gateway.py the one gateway client (headers, LLM, MCP, skill, A2A)
│ ├── identity.py the agent's release identity
│ ├── graph.py the LangGraph graph, one run per application
│ ├── outcomes.json / .py the declared outcome catalogue
│ ├── approvals.py held decisions: poll, apply, re-raise, hand off
│ ├── failures.py application vs system failures
│ ├── scheduler.py the tick loop and back-off
│ └── rules.py, prompts.py the policy floor and the two prompts
├── brutor-demo-applications-mcp/ given: the loan origination system (MCP)
├── brutor-demo-credit-bureau-mcp/ given: identity check + credit report (MCP)
├── brutor-demo-affordability-skill/ given: the affordability-check skill
├── brutor-demo-fraud-screener-agent/ given: the A2A fraud screener
└── brutor-demo-setup/setup.py provisioning: every Admin API call on these pages