<p align="center">
  <img src="https://storage.googleapis.com/agenticwork-cdn/oats/oats-banner.png" alt="OAT — On-demand Agent Tooling" />
</p>

<p align="center">
  <strong>LLMs don't pick from a menu. They cook what they need.</strong>
</p>

<p align="center">
  <a href="https://github.com/agentic-work/oats/actions"><img src="https://img.shields.io/github/actions/workflow/status/agentic-work/oats/ci.yml?style=flat-square&label=CI" alt="CI" /></a>
  <a href="https://pypi.org/project/oat-ai/"><img src="https://img.shields.io/pypi/v/oat-ai?style=flat-square&color=%2366e5a6" alt="PyPI" /></a>
  <a href="https://github.com/agentic-work/oats/blob/main/LICENSE"><img src="https://img.shields.io/github/license/agentic-work/oats?style=flat-square" alt="MIT License" /></a>
  <a href="https://github.com/agentic-work/oats/stargazers"><img src="https://img.shields.io/github/stars/agentic-work/oats?style=flat-square&color=f2a659" alt="Stars" /></a>
  <img src="https://img.shields.io/badge/python-3.11%2B-blue?style=flat-square" alt="Python 3.11+" />
</p>

<p align="center">
  <a href="https://oat.agenticwork.io">Website</a> &bull;
  <a href="https://oat.agenticwork.io">Docs</a> &bull;
  <a href="https://agenticwork.io">AgenticWork Platform</a> &bull;
  <a href="https://github.com/agentic-work/oats/discussions">Discussions</a>
</p>

---

## What is OAT?

**OAT (On-demand Agent Tooling)** lets LLMs synthesize tools on-the-fly instead of relying on pre-built tool libraries. You describe what you need in plain English. The LLM writes an async Python function, self-assesses risk, and presents it for your approval. You review the code and approve or deny. Approved tools execute in a sandbox and are discarded after use.

No MCP server to install. No schema to maintain. No tool registry to manage.

---

## See it in action

### Cloud LLM — AgenticWork API

OAT's default provider hits the AgenticWork platform's model router. No Anthropic key needed.

<p align="center">
  <img src="demos/11-agenticwork-api.gif" alt="OAT synthesizing a tool via AgenticWork API" />
</p>

### Self-hosted LLM — Ollama (air-gapped)

Point OAT at your own Ollama instance. Works behind firewalls, VPNs, fully disconnected networks.

<p align="center">
  <img src="demos/12-ollama-hal.gif" alt="OAT synthesizing a tool via Ollama on local hardware" />
</p>

### Cloud infrastructure — GCP, AWS, Azure

Synthesize cloud tools using ambient credentials. No SDK install, no config files.

<p align="center">
  <img src="demos/13-gcp-cloud-scan.gif" alt="OAT synthesizing cloud infrastructure tools for GCP and AWS" />
</p>

---

## How it works

```
Intent → Capabilities → LLM Synthesis → Human Approval → Sandbox Execution → Discard
```

1. **You describe what you want** in natural language
2. **OAT resolves capabilities** — which APIs, services, and credentials are available
3. **The LLM writes an async Python function** tailored to your request, using only the capabilities you've enabled
4. **You review everything** — the code, risk level, explanation, requested scopes — then approve or deny
5. **Approved tools execute in a sandbox** with scoped credentials and a timeout
6. **Tools are discarded after use** — no schema debt, no zombie tools, no tool registry bloat

The human-in-the-loop gate is mandatory and cannot be bypassed. Every synthesized tool is reviewed before execution.

---

## Quick start

```bash
pip install oat-ai
```

### CLI

```bash
# Default provider (AgenticWork API)
export AGENTICWORK_API_KEY=your-key
oat synth "list all S3 buckets in my AWS account"

# Dry run — see the synthesized code without executing
oat synth "get my AWS bill for this month" --dry-run

# Limit capabilities
oat synth "fetch the weather for NYC" -c http --dry-run

# Use Anthropic directly
oat synth "find open GitHub issues labeled bug" --provider anthropic

# Use Ollama on a remote server
oat synth "check disk usage" --provider ollama --base-url http://hal:11434 --model qwen2.5:32b

# Use AWS Bedrock
oat synth "list my EC2 instances" --provider bedrock
```

### MCP Server (Claude Code integration)

Add to `.mcp.json` in your project root:

```json
{
  "mcpServers": {
    "oat": {
      "command": "oat",
      "args": ["mcp", "serve"],
      "env": {
        "SYNTH_PROVIDER": "agenticwork",
        "AGENTICWORK_API_KEY": "your-key"
      }
    }
  }
}
```

Claude Code can then synthesize and execute tools on demand through the MCP protocol.

### Python library

```python
import asyncio
from oats import CapabilityRegistry, Synthesizer, Executor, HITLGate
from oats.core.llm import create_llm_client
from oats.hitl.gate import CLIApprovalHandler

async def main():
    registry = CapabilityRegistry()
    registry.register_builtin("http", "github", "aws")

    client = create_llm_client("agenticwork", api_key="your-key")
    synthesizer = Synthesizer(llm_client=client, capability_registry=registry)
    tool = await synthesizer.synthesize("get my AWS costs for the last 7 days by service")

    gate = HITLGate(handler=CLIApprovalHandler())
    decision = await gate.submit_for_approval(tool)

    if decision.approved:
        output = await Executor().execute(tool)
        print(output.result)

asyncio.run(main())
```

---

## Supported LLM providers

| Provider | Config | Notes |
|----------|--------|-------|
| **AgenticWork** (default) | `--provider agenticwork` | Platform model router, `AGENTICWORK_API_KEY` |
| **Anthropic** | `--provider anthropic` | Claude models, `ANTHROPIC_API_KEY` |
| **AWS Bedrock** | `--provider bedrock` | Claude on AWS, uses IAM credentials |
| **Ollama** | `--provider ollama --base-url http://host:11434` | Local/self-hosted, any GGUF model |
| **OpenAI-compatible** | `--provider openai --base-url https://your-api.com` | vLLM, LocalAI, Azure OpenAI, etc. |

---

## Built-in capabilities

| Capability | What it provides |
|-----------|-----------------|
| `http` | HTTP requests to any API (httpx) |
| `github` | GitHub REST API — repos, issues, PRs, notifications |
| `slack` | Slack Web API — messages, channels, users |
| `aws` | AWS via boto3 — S3, EC2, Lambda, Cost Explorer, CloudWatch |
| `gcp` | Google Cloud — Storage, BigQuery, Compute, Billing |
| `azure` | Azure — Blob Storage, Cosmos DB, Key Vault, Functions |
| `filesystem` | Read/write local files (pathlib) |
| `shell` | Run shell commands (async subprocess) |
| `json` | Parse/transform JSON |
| `datetime` | Date/time with timezone support |
| `data` | Sort, filter, group, aggregate |

Capabilities are defined in YAML. Add your own for internal APIs, databases, or any service:

```yaml
capabilities:
  - name: myapi
    description: Access the internal Acme API for order management
    auth:
      type: bearer
      token_env_var: ACME_API_TOKEN
    allowed_domains:
      - api.acme.internal
```

---

## What can OAT replace?

| Instead of installing... | Just say... |
|--------------------------|-------------|
| A GitHub MCP server | `oat synth "show my open PRs with failing CI"` |
| An AWS cost tool | `oat synth "get AWS spending for the last 30 days by service"` |
| A GCP storage client | `oat synth "list all GCS buckets and their sizes"` |
| A Jira integration | `oat synth "find overdue tickets assigned to me"` |
| A Slack bot | `oat synth "post deploy summary to #engineering"` |
| A custom API wrapper | `oat synth "call the Acme API and list active orders"` |

---

## AgenticWork Platform

OAT is the open-source engine behind the [AgenticWork Platform](https://agenticwork.io). The platform adds:

- **One-click OAuth** — connect GitHub, AWS, GCP, Azure, Slack, Jira through your browser
- **Credential vault** — encrypted, scoped, auto-rotated tokens
- **Web approval UI** — review and approve tools with one click
- **Server-side sandbox** — isolated container execution on managed infra
- **Team access controls** — role-based permissions across your org
- **Audit log** — every synthesis, approval, and execution is recorded

<p align="center">
  <a href="https://agenticwork.io"><strong>Try the AgenticWork Platform →</strong></a>
</p>

---

## Contributing

```bash
git clone https://github.com/agentic-work/oats.git
cd oats
pip install -e ".[dev]"

pytest                                    # Run tests
mypy oats/ --ignore-missing-imports       # Type check
ruff check oats/                          # Lint
```

All three must pass. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

## License

MIT — see [LICENSE](LICENSE)

---

<p align="center">
  <strong>OAT</strong> — On-demand Agent Tooling<br />
  <sub>The open-source engine behind <a href="https://agenticwork.io">AgenticWork</a></sub>
</p>
