vantage-agents 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vantage_agents-0.1.0/.env.example +4 -0
- vantage_agents-0.1.0/.github/CODEOWNERS +1 -0
- vantage_agents-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- vantage_agents-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- vantage_agents-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +16 -0
- vantage_agents-0.1.0/.github/workflows/ci.yml +42 -0
- vantage_agents-0.1.0/.github/workflows/publish.yml +29 -0
- vantage_agents-0.1.0/.gitignore +17 -0
- vantage_agents-0.1.0/CHANGELOG.md +25 -0
- vantage_agents-0.1.0/CONTRIBUTING.md +80 -0
- vantage_agents-0.1.0/LICENSE +21 -0
- vantage_agents-0.1.0/Makefile +45 -0
- vantage_agents-0.1.0/PKG-INFO +240 -0
- vantage_agents-0.1.0/README.md +207 -0
- vantage_agents-0.1.0/assets/logo.png +0 -0
- vantage_agents-0.1.0/examples/__init__.py +0 -0
- vantage_agents-0.1.0/examples/calculator_agent/__init__.py +0 -0
- vantage_agents-0.1.0/examples/calculator_agent/calculator.yaml +10 -0
- vantage_agents-0.1.0/examples/calculator_agent/run.py +25 -0
- vantage_agents-0.1.0/examples/calculator_agent/trace.png +0 -0
- vantage_agents-0.1.0/examples/custom_tool_agent/__init__.py +0 -0
- vantage_agents-0.1.0/examples/custom_tool_agent/run.py +26 -0
- vantage_agents-0.1.0/examples/custom_tool_agent/tools.py +34 -0
- vantage_agents-0.1.0/examples/custom_tool_agent/trace.png +0 -0
- vantage_agents-0.1.0/examples/custom_tool_agent/word_agent.yaml +10 -0
- vantage_agents-0.1.0/examples/multi_agent_flow/agents.yaml +26 -0
- vantage_agents-0.1.0/examples/multi_agent_flow/run.py +36 -0
- vantage_agents-0.1.0/examples/multi_agent_flow/trace.png +0 -0
- vantage_agents-0.1.0/examples/stack_overflow_agent/run.py +23 -0
- vantage_agents-0.1.0/examples/stack_overflow_agent/stack_overflow_agent.yaml +10 -0
- vantage_agents-0.1.0/examples/stack_overflow_agent/tools.py +7 -0
- vantage_agents-0.1.0/examples/stack_overflow_agent/trace.png +0 -0
- vantage_agents-0.1.0/examples/weather_agent/__init__.py +0 -0
- vantage_agents-0.1.0/examples/weather_agent/run.py +26 -0
- vantage_agents-0.1.0/examples/weather_agent/trace.png +0 -0
- vantage_agents-0.1.0/examples/weather_agent/weather_agent.yaml +12 -0
- vantage_agents-0.1.0/pyproject.toml +55 -0
- vantage_agents-0.1.0/scripts/bootstrap.ps1 +31 -0
- vantage_agents-0.1.0/scripts/bootstrap.sh +27 -0
- vantage_agents-0.1.0/src/vantage/__init__.py +22 -0
- vantage_agents-0.1.0/src/vantage/cli.py +36 -0
- vantage_agents-0.1.0/src/vantage/config.py +324 -0
- vantage_agents-0.1.0/src/vantage/core/__init__.py +18 -0
- vantage_agents-0.1.0/src/vantage/core/agent.py +262 -0
- vantage_agents-0.1.0/src/vantage/core/bases.py +73 -0
- vantage_agents-0.1.0/src/vantage/core/handovers.py +22 -0
- vantage_agents-0.1.0/src/vantage/core/models.py +45 -0
- vantage_agents-0.1.0/src/vantage/llms/__init__.py +5 -0
- vantage_agents-0.1.0/src/vantage/llms/groq.py +206 -0
- vantage_agents-0.1.0/src/vantage/llms/openai.py +245 -0
- vantage_agents-0.1.0/src/vantage/memory/__init__.py +3 -0
- vantage_agents-0.1.0/src/vantage/memory/local.py +19 -0
- vantage_agents-0.1.0/src/vantage/py.typed +0 -0
- vantage_agents-0.1.0/src/vantage/runtime.py +125 -0
- vantage_agents-0.1.0/src/vantage/tools/__init__.py +13 -0
- vantage_agents-0.1.0/src/vantage/tools/calculator.py +80 -0
- vantage_agents-0.1.0/src/vantage/tools/dictionary_tool.py +88 -0
- vantage_agents-0.1.0/src/vantage/tools/stack_overflow_tool.py +65 -0
- vantage_agents-0.1.0/src/vantage/tools/weather_tool.py +61 -0
- vantage_agents-0.1.0/src/vantage/tools/wikipedia_tool.py +82 -0
- vantage_agents-0.1.0/src/vantage/utils/__init__.py +3 -0
- vantage_agents-0.1.0/src/vantage/utils/viz.py +184 -0
- vantage_agents-0.1.0/tests/conftest.py +40 -0
- vantage_agents-0.1.0/tests/test_agent.py +161 -0
- vantage_agents-0.1.0/tests/test_async.py +102 -0
- vantage_agents-0.1.0/tests/test_config.py +158 -0
- vantage_agents-0.1.0/tests/test_handover.py +27 -0
- vantage_agents-0.1.0/tests/test_memory.py +41 -0
- vantage_agents-0.1.0/tests/test_yaml_and_llms.py +152 -0
- vantage_agents-0.1.0/tests/tools/test_stack_overflow_tool.py +60 -0
- vantage_agents-0.1.0/tests/tools/test_weather_tool.py +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @saqlain2204
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report a reproducible defect
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Describe the bug**
|
|
8
|
+
A clear description of what the bug is.
|
|
9
|
+
|
|
10
|
+
**To reproduce**
|
|
11
|
+
Steps to reproduce the behaviour:
|
|
12
|
+
1. ...
|
|
13
|
+
2. ...
|
|
14
|
+
|
|
15
|
+
**Expected behaviour**
|
|
16
|
+
What you expected to happen.
|
|
17
|
+
|
|
18
|
+
**Actual behaviour**
|
|
19
|
+
What actually happened. Include the full traceback if applicable.
|
|
20
|
+
|
|
21
|
+
**Environment**
|
|
22
|
+
- Vantage version:
|
|
23
|
+
- Python version:
|
|
24
|
+
- OS:
|
|
25
|
+
|
|
26
|
+
**Minimal reproducible example**
|
|
27
|
+
```python
|
|
28
|
+
# paste code here
|
|
29
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an improvement or new capability
|
|
4
|
+
labels: enhancement
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Summary**
|
|
8
|
+
A short description of the feature you would like.
|
|
9
|
+
|
|
10
|
+
**Motivation**
|
|
11
|
+
Why is this feature useful? What problem does it solve?
|
|
12
|
+
|
|
13
|
+
**Proposed solution**
|
|
14
|
+
How would you implement this? (optional, but helpful)
|
|
15
|
+
|
|
16
|
+
**Alternatives considered**
|
|
17
|
+
Have you considered any alternative approaches?
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- One sentence describing what this PR does -->
|
|
4
|
+
|
|
5
|
+
## Changes
|
|
6
|
+
|
|
7
|
+
<!-- Bullet list of what was changed and why -->
|
|
8
|
+
|
|
9
|
+
## Checklist
|
|
10
|
+
|
|
11
|
+
- [ ] Tests added or updated for every changed behaviour
|
|
12
|
+
- [ ] All existing tests pass (`python -m pytest -q`)
|
|
13
|
+
- [ ] Type annotations present on all new public symbols
|
|
14
|
+
- [ ] `mypy src/vantage` passes
|
|
15
|
+
- [ ] `ruff check .` passes
|
|
16
|
+
- [ ] `CHANGELOG.md` updated under `[Unreleased]`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.12"]
|
|
16
|
+
os: [ubuntu-latest]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint with ruff
|
|
30
|
+
run: python -m ruff check .
|
|
31
|
+
|
|
32
|
+
- name: Type-check with mypy
|
|
33
|
+
run: python -m mypy src/vantage
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: python -m pytest --cov=vantage --cov-report=xml -q
|
|
37
|
+
|
|
38
|
+
- name: Upload coverage
|
|
39
|
+
uses: codecov/codecov-action@v4
|
|
40
|
+
with:
|
|
41
|
+
files: coverage.xml
|
|
42
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: pypi
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Build distribution
|
|
24
|
+
run: |
|
|
25
|
+
pip install build
|
|
26
|
+
python -m build
|
|
27
|
+
|
|
28
|
+
- name: Publish to PyPI
|
|
29
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0] — 2026-03-30
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `Agent` for synchronous single-agent and multi-agent flows.
|
|
14
|
+
- `AsyncAgent` with `run()` and `stream()` for async/streaming usage.
|
|
15
|
+
- `OpenAIModel` and `GroqModel` sync LLM clients.
|
|
16
|
+
- `AsyncOpenAIModel` and `AsyncGroqModel` async LLM clients with SSE streaming.
|
|
17
|
+
- `LocalMemory` for in-process conversation history.
|
|
18
|
+
- `Calculator` built-in tool using a safe AST-based evaluator.
|
|
19
|
+
- `HandoverTool` for routing between agents in multi-agent flows.
|
|
20
|
+
- `run_yaml_agent` and `async_run_yaml_agent` for YAML-driven agent execution.
|
|
21
|
+
- `save_trace_png` for rendering execution traces as PNG diagrams.
|
|
22
|
+
- New flat YAML format: `model: provider/model-name` — no `providers:` block required.
|
|
23
|
+
- `response_schema` shorthand: `{field: type}` expanded to full JSON Schema automatically.
|
|
24
|
+
- GitHub Actions CI pipeline (Python 3.11 / 3.12 / 3.13, ubuntu / windows / macos).
|
|
25
|
+
- GitHub Actions publish workflow for PyPI releases.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Contributing to Vantage
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Vantage.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/saqlain2204/vantage.git
|
|
9
|
+
cd vantage
|
|
10
|
+
python -m venv .venv
|
|
11
|
+
# Windows
|
|
12
|
+
.venv\Scripts\activate
|
|
13
|
+
# Linux / macOS
|
|
14
|
+
source .venv/bin/activate
|
|
15
|
+
|
|
16
|
+
pip install -e ".[dev]"
|
|
17
|
+
cp .env.example .env # fill in your API keys
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
1. **Fork** the repository and clone your fork.
|
|
23
|
+
2. **Create a branch** — one branch per feature or bug fix.
|
|
24
|
+
3. **Make your changes** and add tests under `tests/`.
|
|
25
|
+
4. **Fix any lint errors** automatically:
|
|
26
|
+
```bash
|
|
27
|
+
make lint-fix
|
|
28
|
+
```
|
|
29
|
+
5. **Verify** the full check suite passes:
|
|
30
|
+
```bash
|
|
31
|
+
make lint
|
|
32
|
+
make test
|
|
33
|
+
```
|
|
34
|
+
Or manually:
|
|
35
|
+
```bash
|
|
36
|
+
python -m ruff check .
|
|
37
|
+
python -m mypy src/vantage
|
|
38
|
+
python -m pytest -q
|
|
39
|
+
```
|
|
40
|
+
6. **Submit a Pull Request** against `main`.
|
|
41
|
+
|
|
42
|
+
## Code conventions
|
|
43
|
+
|
|
44
|
+
- Follow PEP 8 and PEP 526.
|
|
45
|
+
- Use type annotations on all public functions and methods. The project targets `mypy --strict` compliance.
|
|
46
|
+
- Keep components modular and single-purpose.
|
|
47
|
+
- Async counterparts (`AsyncAgent`, `AsyncOpenAIModel`, etc.) must mirror the sync API exactly.
|
|
48
|
+
- Do not add dependencies to `pyproject.toml` without discussion in an issue first.
|
|
49
|
+
|
|
50
|
+
## Tests
|
|
51
|
+
|
|
52
|
+
All new features and bug fixes must include tests. Run the suite with:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python -m pytest -q
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For coverage:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python -m pytest --cov=vantage --cov-report=term-missing -q
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Async tests use `pytest-asyncio`. Mark them with `@pytest.mark.asyncio`.
|
|
65
|
+
|
|
66
|
+
## Commit messages
|
|
67
|
+
|
|
68
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/) format:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
feat: add Redis memory backend
|
|
72
|
+
fix: correct tool_calls serialisation in OpenAI client
|
|
73
|
+
docs: update Quick Start YAML example
|
|
74
|
+
chore: bump Pillow to 11.0
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Changelog
|
|
78
|
+
|
|
79
|
+
Update `CHANGELOG.md` under the `[Unreleased]` heading for every user-visible change.
|
|
80
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 M Saqlain
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.PHONY: help setup install test lint lint-fix typecheck format coverage
|
|
2
|
+
|
|
3
|
+
# Override with: make setup PYTHON=python3.11
|
|
4
|
+
PYTHON ?= python
|
|
5
|
+
|
|
6
|
+
help:
|
|
7
|
+
@echo "Vantage — available targets:"
|
|
8
|
+
@echo ""
|
|
9
|
+
@echo " setup Create a virtual environment and install all dependencies"
|
|
10
|
+
@echo " install Install the package in editable mode"
|
|
11
|
+
@echo " test Run the test suite with pytest"
|
|
12
|
+
@echo " lint Run ruff and mypy"
|
|
13
|
+
@echo " lint-fix Auto-fix ruff lint errors"
|
|
14
|
+
@echo " typecheck Run mypy only"
|
|
15
|
+
@echo " format Auto-format source with ruff"
|
|
16
|
+
@echo " coverage Run tests and produce an HTML coverage report"
|
|
17
|
+
|
|
18
|
+
setup:
|
|
19
|
+
$(PYTHON) -m venv .venv
|
|
20
|
+
$(PYTHON) -m pip install --upgrade pip
|
|
21
|
+
$(PYTHON) -m pip install -e ".[dev]"
|
|
22
|
+
|
|
23
|
+
install:
|
|
24
|
+
$(PYTHON) -m pip install -e .
|
|
25
|
+
|
|
26
|
+
test:
|
|
27
|
+
$(PYTHON) -m pytest -q
|
|
28
|
+
|
|
29
|
+
lint:
|
|
30
|
+
$(PYTHON) -m ruff check .
|
|
31
|
+
$(PYTHON) -m mypy src/vantage
|
|
32
|
+
|
|
33
|
+
lint-fix:
|
|
34
|
+
$(PYTHON) -m ruff check --fix .
|
|
35
|
+
|
|
36
|
+
typecheck:
|
|
37
|
+
$(PYTHON) -m mypy src/vantage
|
|
38
|
+
|
|
39
|
+
format:
|
|
40
|
+
$(PYTHON) -m ruff format .
|
|
41
|
+
$(PYTHON) -m ruff check . --fix
|
|
42
|
+
|
|
43
|
+
coverage:
|
|
44
|
+
$(PYTHON) -m pytest --cov=vantage --cov-report=html --cov-report=term-missing -q
|
|
45
|
+
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vantage-agents
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A modular and extensible Python library for building AI agents.
|
|
5
|
+
Project-URL: Homepage, https://github.com/saqlain2204/vantage
|
|
6
|
+
Project-URL: Issues, https://github.com/saqlain2204/vantage/issues
|
|
7
|
+
Author-email: Saqlain <saqlain2204@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: httpx>=0.27.0
|
|
19
|
+
Requires-Dist: pillow>=10.0.0
|
|
20
|
+
Requires-Dist: pydantic>=2.0.0
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
23
|
+
Requires-Dist: rich>=13.0.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: mypy>=1.10.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: types-pyyaml>=0.1.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Vantage
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="assets/logo.png" alt="Vantage Logo" width="400" height="400" />
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
**A lightweight, protocol-first Python library for building AI agents.**
|
|
41
|
+
|
|
42
|
+
[](https://github.com/saqlain2204/vantage/actions/workflows/ci.yml)
|
|
43
|
+
[](https://badge.fury.io/py/vantage-agents)
|
|
44
|
+
[](https://www.python.org/)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
[](https://github.com/astral-sh/ruff)
|
|
47
|
+
|
|
48
|
+
Vantage is a modular Python library for building AI agents. It follows SOLID principles and defines every component — LLMs, tools, and memory — as an abstract interface, making each one independently replaceable without changing agent logic.
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- **Simple YAML configuration**: Define agents, models, and tools in a flat, human-readable YAML file. No boilerplate.
|
|
53
|
+
- **Swappable components**: Implement `LLMBase`, `ToolBase`, or `MemoryBase` to replace any layer transparently.
|
|
54
|
+
- **Multi-agent flows**: Route requests between specialised agents with `HandoverTool`.
|
|
55
|
+
- **Sync and async**: Full async support with token streaming alongside the synchronous API.
|
|
56
|
+
- **Execution tracing**: Export a PNG diagram of every step in an agent's execution via `save_trace_png`.
|
|
57
|
+
- **Structured output**: Request JSON-schema-validated responses with a one-line field shorthand.
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install vantage-agents
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
### Python API
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from vantage.core import Agent
|
|
71
|
+
from vantage.llms import OpenAIModel
|
|
72
|
+
from vantage.memory import LocalMemory
|
|
73
|
+
from vantage.tools import Calculator
|
|
74
|
+
|
|
75
|
+
agent = Agent(
|
|
76
|
+
llm=OpenAIModel(model="gpt-4o-mini"),
|
|
77
|
+
tools=[Calculator()],
|
|
78
|
+
memory=LocalMemory(),
|
|
79
|
+
system_prompt="You are a math assistant.",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
response = agent.run("What is (12 + 8) / 5?")
|
|
83
|
+
print(response.content)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### YAML configuration
|
|
87
|
+
|
|
88
|
+
Define agents in a YAML file — the `model` key sets both the provider and the model in one line:
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
agents:
|
|
92
|
+
calc_bot:
|
|
93
|
+
model: groq/llama-3.3-70b-versatile
|
|
94
|
+
system_prompt: "You are a math assistant. Use the calculator tool for arithmetic."
|
|
95
|
+
tools: [calculator]
|
|
96
|
+
response_schema:
|
|
97
|
+
result: number
|
|
98
|
+
explanation: string
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from vantage import run_yaml_agent
|
|
103
|
+
from vantage.tools import Calculator
|
|
104
|
+
|
|
105
|
+
resp = run_yaml_agent("agents.yaml", "calc_bot", "What is 15 * 12?", tools=[Calculator()])
|
|
106
|
+
print(resp.content)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`response_schema` accepts a flat `{field: type}` shorthand that is automatically expanded to a full JSON Schema. Supported types: `string`, `number`, `integer`, `boolean`, `array`, `object`.
|
|
110
|
+
|
|
111
|
+
### Async and streaming
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import asyncio
|
|
115
|
+
from vantage.core import AsyncAgent
|
|
116
|
+
from vantage.llms import AsyncOpenAIModel
|
|
117
|
+
|
|
118
|
+
agent = AsyncAgent(
|
|
119
|
+
llm=AsyncOpenAIModel(model="gpt-4o-mini"),
|
|
120
|
+
system_prompt="You are helpful.",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
async def main() -> None:
|
|
124
|
+
async for token in agent.stream("Explain gradient descent briefly."):
|
|
125
|
+
print(token, end="", flush=True)
|
|
126
|
+
|
|
127
|
+
asyncio.run(main())
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Architecture
|
|
131
|
+
|
|
132
|
+
```mermaid
|
|
133
|
+
graph TD
|
|
134
|
+
A[Agent / AsyncAgent] --> B[LLMBase]
|
|
135
|
+
A --> C[MemoryBase]
|
|
136
|
+
A --> D[ToolBase]
|
|
137
|
+
B --> B1[OpenAIModel / AsyncOpenAIModel]
|
|
138
|
+
B --> B2[GroqModel / AsyncGroqModel]
|
|
139
|
+
C --> C1[LocalMemory]
|
|
140
|
+
D --> D1[Calculator]
|
|
141
|
+
D --> D2[HandoverTool]
|
|
142
|
+
D --> D3[Custom Tools]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Every arrow in the diagram is an interface boundary — swap any node without touching the others.
|
|
146
|
+
|
|
147
|
+
## Extending Vantage
|
|
148
|
+
|
|
149
|
+
### Custom tool
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from vantage.core import ToolBase
|
|
153
|
+
|
|
154
|
+
class WeatherTool(ToolBase):
|
|
155
|
+
@property
|
|
156
|
+
def name(self) -> str:
|
|
157
|
+
return "get_weather"
|
|
158
|
+
|
|
159
|
+
@property
|
|
160
|
+
def description(self) -> str:
|
|
161
|
+
return "Return the current weather for a city."
|
|
162
|
+
|
|
163
|
+
def input_schema(self):
|
|
164
|
+
return {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"properties": {"city": {"type": "string"}},
|
|
167
|
+
"required": ["city"],
|
|
168
|
+
"additionalProperties": False,
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
def execute(self, **kwargs) -> str:
|
|
172
|
+
city = kwargs["city"]
|
|
173
|
+
return f"Sunny, 22 C in {city}" # replace with a real API call
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Custom LLM backend
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
from vantage.core import LLMBase
|
|
180
|
+
from vantage.core.models import Message, Role
|
|
181
|
+
|
|
182
|
+
class MyLLM(LLMBase):
|
|
183
|
+
def generate(self, messages, tools, response_schema=None) -> Message:
|
|
184
|
+
# call your backend here
|
|
185
|
+
return Message(role=Role.ASSISTANT, content="...")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Multi-agent flows
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from vantage import run_yaml_agent, Calculator
|
|
192
|
+
from vantage.core.handovers import HandoverTool
|
|
193
|
+
|
|
194
|
+
tools = [
|
|
195
|
+
Calculator(),
|
|
196
|
+
HandoverTool("math_expert", "Transfer to the math expert."),
|
|
197
|
+
HandoverTool("word_expert", "Transfer to the word expert."),
|
|
198
|
+
]
|
|
199
|
+
|
|
200
|
+
resp = run_yaml_agent("agents.yaml", "gatekeeper", "What is 6 * 7?", tools=tools)
|
|
201
|
+
print(resp.content)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Execution tracing
|
|
205
|
+
|
|
206
|
+
Every `AgentResponse` carries a `trace` list. Render it as a PNG:
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
from vantage import save_trace_png
|
|
210
|
+
|
|
211
|
+
save_trace_png(resp.trace, "trace.png")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
The diagram shows every step — user input, LLM reasoning, tool calls, tool results, and the final answer — with the actual content of each step.
|
|
215
|
+
|
|
216
|
+
## Running the examples
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
git clone https://github.com/saqlain2204/vantage.git
|
|
220
|
+
cd vantage
|
|
221
|
+
pip install -e ".[dev]"
|
|
222
|
+
cp .env.example .env # add your API keys
|
|
223
|
+
|
|
224
|
+
python -m examples.calculator_agent.run
|
|
225
|
+
python -m examples.custom_tool_agent.run
|
|
226
|
+
python -m examples.multi_agent_flow.run
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup, coding conventions, and how to submit a pull request.
|
|
232
|
+
|
|
233
|
+
## Changelog
|
|
234
|
+
|
|
235
|
+
See [CHANGELOG.md](CHANGELOG.md) for the version history.
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
Vantage is released under the [MIT License](LICENSE).
|
|
240
|
+
|