Open reference implementation of agentic AI patterns for API teams
NEXUS-Lite demonstrates how to build provider-agnostic agentic AI workflows that integrate with existing enterprise and government API infrastructure. It is designed to be read, forked, and adapted — not just installed.
NEXUS-Lite is a minimal, well-documented implementation of the agentic loop pattern: a technique where a large language model (LLM) drives multi-step reasoning by calling tools, interpreting results, and iterating until it produces a final answer.
The reference implementation ships with:
- A provider-agnostic agent core (OpenAI SDK, works with any OpenAI-compatible endpoint)
- Four operational demo tools modeled on DoD-style capability assessment workflows
- Integrations for n8n (visual workflow automation)
- Docs for swapping providers with two environment variable changes
- Architecture diagrams explaining exactly what is happening at each step
This is educational-grade code written to be understood, not just executed.
Modern AI capabilities are increasingly delivered as API endpoints. The challenge is not accessing a model — it is orchestrating a model to do useful, multi-step work against your existing systems.
The agentic loop pattern solves this. It lets you:
- Give a model access to your APIs as callable tools
- Let the model decide which tools to call and in what order
- Get a reasoned, structured answer grounded in real data — not hallucination
This pattern is model-agnostic, cloud-agnostic, and classification-boundary safe when deployed correctly. NEXUS-Lite shows you exactly how it works, step by step.
Prerequisites: Python 3.10+, pip, and access to any supported provider (Ollama works locally with no API key).
# 1. Clone the repository
git clone https://github.com/your-org/nexus-lite.git
cd nexus-lite
# 2. Install dependencies
pip install openai python-dotenv
# 3. Configure your provider (defaults to local Ollama)
export NEXUS_BASE_URL="http://localhost:11434/v1"
export NEXUS_API_KEY="ollama"
export NEXUS_MODEL="qwen2.5:7b"
# 4. Run the demo
python -m demo.runTo use OpenAI instead:
export NEXUS_BASE_URL="https://api.openai.com/v1"
export NEXUS_API_KEY="sk-your-key-here"
export NEXUS_MODEL="gpt-4o"
python -m demo.runThat is all it takes to switch providers. No code changes. See docs/provider-configuration.md for all supported providers.
| Provider | Base URL Pattern | Notes |
|---|---|---|
| Ollama (local) | http://localhost:11434/v1 |
No API key required |
| OpenAI | https://api.openai.com/v1 |
Requires NEXUS_API_KEY=sk-... |
| Google Gemini | https://generativelanguage.googleapis.com/v1beta/openai |
OpenAI-compatible endpoint |
| Azure OpenAI | https://{resource}.openai.azure.com |
Requires deployment name as model |
| AWS Bedrock | Via LiteLLM proxy | See provider docs |
Full configuration details: docs/provider-configuration.md
n8n is an open-source workflow automation platform. NEXUS-Lite ships with a ready-to-import n8n workflow that:
- Triggers the agent via HTTP webhook or schedule
- POSTs a task to the NEXUS-Lite agent endpoint
- Handles the structured response
See integrations/n8n/README.md and docs/n8n-integration.md.
NEXUS-Lite exposes a simple HTTP interface. Any system that can make an HTTP POST request can trigger an agent run. See docs/extending-integrations.md for the interface contract and integration skeleton.
The core agentic loop:
User submits task
│
▼
Agent sends task + tool definitions to LLM
│
▼
LLM responds: "call tool X with args Y"
│
▼
Agent executes tool, gets result
│
▼
Agent sends result back to LLM (with full history)
│
▼
LLM responds: another tool call OR final answer
│
(repeat until final answer)
│
▼
Agent returns final answer + metadata to user
Full sequence diagrams with provider swap architecture: diagrams/agentic-loop.md
The key architectural property: the agent core never changes when you change providers. The only coupling is through environment variables.
nexus-lite/
├── demo/ # Runnable agent demo
│ ├── config.py # Provider-agnostic configuration
│ ├── tools.py # Four operational tools
│ ├── agent.py # Core agentic loop
│ └── run.py # Entry point
├── docs/ # Detailed documentation
├── integrations/ # Integration packages (n8n, etc.)
├── diagrams/ # Architecture diagrams (Mermaid)
└── deck/ # Presentation materials
Contributions are welcome. Please read CONTRIBUTING.md before submitting a pull request.
Apache License 2.0. See LICENSE.
NEXUS-Lite covers the agentic loop fundamentals. For production-scale orchestration — multi-agent coordination, persistent memory, audit logging, and enterprise deployment patterns — see NEXUS.