Live demo · runs the real ReAct agent & eval harness server-side

A ReAct agent you can actually measure.

reagent is a tool-using ReAct + RAG assistant over a small Northwind knowledge base — BM25 doc_search, a calculator, and a structured employee lookup, reasoned in an explicit Thought → Action → Observation loop. The headline act is a built-in evaluation harness: a labeled test set scored for accuracy, tool-selection, safety/refusal, latency and token cost. Ask it something, then watch it grade itself.

Live demo · Ask

Ask the agent, watch it reason

Each question runs the real agent server-side. It thinks in an explicit Thought → Action(tool) → Observation loop, calls doc_search, calculator and table_lookup as needed, then returns a grounded Final Answer — or refuses, with no tool calls, on unsafe / out-of-scope prompts.

Try an example

Mode is chosen automatically — live OpenRouter if a key is set, else a deterministic mock LLM.
The centerpiece · Evaluation

The agent, graded

A shipped agent is only as trustworthy as its evaluation. reagent bundles a labeled test set across multi-step, single-tool, pure-RAG and safety categories, and scores every case for answer accuracy, correct tool selection, and safe refusal — plus latency, token cost and step count. Grading is deterministic in mock mode and an LLM-as-judge in live mode.

Evaluation scorecard

Run the harness to score the labeled test set.

Press Run evaluation to execute the harness over the bundled cases.

Mock mode is instant & deterministic. Live mode makes ~40 model calls and takes 30–60s; the result is cached server-side.

For the role

What reagent demonstrates

Every capability below maps to the Cohere Forward Deployed Engineer, Agentic Platform role and is backed by a real, tested module in reagent — not slideware.

Build tool-using agents for customers

A ReAct loop that picks tools from a registry, executes them, and feeds observations back until a grounded final answer — with a hard step cap.

agent.py → Agent.run

RAG / retrieval over enterprise knowledge

Embedding-free Okapi BM25 over chunked markdown; every hit carries its source doc for grounded, citable answers.

retriever.py → Bm25Index · tools.py → doc_search

Tool / function calling design

Three real tools — doc_search (RAG), calculator (safe arithmetic), table_lookup (structured directory) — behind a uniform registry the model is prompted to call.

tools.py → ToolRegistry

Multi-step orchestration

Chains tools across steps, e.g. doc_search THEN calculator to turn a PTO policy into work-weeks — visible in the live trace.

agent.py → step loop · prompts.py

Evaluation & quality measurement

A labeled test set scored for answer accuracy, tool-selection, safety-refusal, latency p50/p95, tokens and steps — deterministic in mock, LLM-as-judge live.

eval.py → run_eval · data/testset.json

Safety & guardrails

Out-of-scope and prompt-injection requests are refused with zero tool calls; the harness scores a dedicated safety category.

agent.py → refusal handling · prompts.py

Provider integration (OpenAI-compatible)

Live OpenRouter client (default openai/gpt-4o-mini) with token accounting; swappable base URL/model via settings.

llm/openrouter.py → OpenRouterLLM

Deterministic offline mode for CI

A mock LLM mirrors the live contract so the whole suite + this demo run offline with no key — mode chosen automatically from the env.

llm/mock.py → MockLLM · config.py

Observability of agent behavior

Structured Step/Metrics trace objects per run: thought, tool, input, observation, plus llm_calls, tokens and latency.

trace.py → Step · Metrics · AgentResult

Production-shaped packaging

A pip-installable package with a typed public API (ask / Agent / run_eval), a CLI, and a tested corpus + data bundle.

__init__.py · cli.py · pyproject.toml