tvastar 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.
- tvastar-0.1.0/.claude/settings.local.json +18 -0
- tvastar-0.1.0/.github/workflows/agent.yml +35 -0
- tvastar-0.1.0/.github/workflows/ci.yml +33 -0
- tvastar-0.1.0/.gitignore +16 -0
- tvastar-0.1.0/CHANGELOG.md +47 -0
- tvastar-0.1.0/CONTRIBUTING.md +73 -0
- tvastar-0.1.0/LICENSE +21 -0
- tvastar-0.1.0/PKG-INFO +451 -0
- tvastar-0.1.0/README.md +403 -0
- tvastar-0.1.0/examples/coding_agent.py +69 -0
- tvastar-0.1.0/examples/custom_provider.py +178 -0
- tvastar-0.1.0/examples/deploy/Dockerfile +23 -0
- tvastar-0.1.0/examples/deploy/github_action_entry.py +25 -0
- tvastar-0.1.0/examples/detect_silent_failure.py +71 -0
- tvastar-0.1.0/examples/mcp_agent.py +61 -0
- tvastar-0.1.0/examples/mcp_echo_server.py +117 -0
- tvastar-0.1.0/examples/proof_groq.py +97 -0
- tvastar-0.1.0/examples/quickstart.py +43 -0
- tvastar-0.1.0/examples/self_healing_agent.py +137 -0
- tvastar-0.1.0/examples/skills/code-reviewer.md +18 -0
- tvastar-0.1.0/pyproject.toml +62 -0
- tvastar-0.1.0/tests/test_agent_loop.py +60 -0
- tvastar-0.1.0/tests/test_deploy.py +57 -0
- tvastar-0.1.0/tests/test_detect.py +147 -0
- tvastar-0.1.0/tests/test_mcp.py +82 -0
- tvastar-0.1.0/tests/test_sandbox.py +49 -0
- tvastar-0.1.0/tests/test_skills_and_durable.py +81 -0
- tvastar-0.1.0/tests/test_tools_schema.py +61 -0
- tvastar-0.1.0/tests/test_virtual_python.py +47 -0
- tvastar-0.1.0/tvastar/__init__.py +139 -0
- tvastar-0.1.0/tvastar/agent.py +114 -0
- tvastar-0.1.0/tvastar/deploy/__init__.py +32 -0
- tvastar-0.1.0/tvastar/deploy/adapters.py +128 -0
- tvastar-0.1.0/tvastar/detect/__init__.py +48 -0
- tvastar-0.1.0/tvastar/detect/base.py +117 -0
- tvastar-0.1.0/tvastar/detect/detectors.py +161 -0
- tvastar-0.1.0/tvastar/detect/jsonschema.py +65 -0
- tvastar-0.1.0/tvastar/durable.py +115 -0
- tvastar-0.1.0/tvastar/errors.py +35 -0
- tvastar-0.1.0/tvastar/filesystem/__init__.py +13 -0
- tvastar-0.1.0/tvastar/filesystem/base.py +62 -0
- tvastar-0.1.0/tvastar/filesystem/local.py +74 -0
- tvastar-0.1.0/tvastar/filesystem/virtual.py +80 -0
- tvastar-0.1.0/tvastar/harness.py +76 -0
- tvastar-0.1.0/tvastar/mcp/__init__.py +22 -0
- tvastar-0.1.0/tvastar/mcp/client.py +173 -0
- tvastar-0.1.0/tvastar/mcp/transport.py +253 -0
- tvastar-0.1.0/tvastar/memory/__init__.py +13 -0
- tvastar-0.1.0/tvastar/memory/store.py +119 -0
- tvastar-0.1.0/tvastar/model/__init__.py +30 -0
- tvastar-0.1.0/tvastar/model/anthropic.py +177 -0
- tvastar-0.1.0/tvastar/model/base.py +65 -0
- tvastar-0.1.0/tvastar/model/mock.py +87 -0
- tvastar-0.1.0/tvastar/model/openai.py +166 -0
- tvastar-0.1.0/tvastar/observability.py +134 -0
- tvastar-0.1.0/tvastar/sandbox/__init__.py +30 -0
- tvastar-0.1.0/tvastar/sandbox/base.py +131 -0
- tvastar-0.1.0/tvastar/sandbox/local.py +90 -0
- tvastar-0.1.0/tvastar/sandbox/providers.py +188 -0
- tvastar-0.1.0/tvastar/sandbox/virtual.py +304 -0
- tvastar-0.1.0/tvastar/serving/__init__.py +9 -0
- tvastar-0.1.0/tvastar/serving/cli.py +125 -0
- tvastar-0.1.0/tvastar/serving/http.py +94 -0
- tvastar-0.1.0/tvastar/serving/loader.py +55 -0
- tvastar-0.1.0/tvastar/session.py +355 -0
- tvastar-0.1.0/tvastar/skills/__init__.py +21 -0
- tvastar-0.1.0/tvastar/skills/loader.py +145 -0
- tvastar-0.1.0/tvastar/tools/__init__.py +15 -0
- tvastar-0.1.0/tvastar/tools/base.py +152 -0
- tvastar-0.1.0/tvastar/tools/builtin.py +129 -0
- tvastar-0.1.0/tvastar/tools/schema.py +130 -0
- tvastar-0.1.0/tvastar/types.py +142 -0
- tvastar-0.1.0/uv.lock +1114 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"WebFetch(domain:flueframework.com)",
|
|
5
|
+
"WebFetch(domain:github.com)",
|
|
6
|
+
"Bash(which uv *)",
|
|
7
|
+
"Bash(uv --version)",
|
|
8
|
+
"Bash(uv venv *)",
|
|
9
|
+
"Bash(uv pip *)",
|
|
10
|
+
"Bash(uv run *)",
|
|
11
|
+
"Bash(INPUT_PROMPT=\"List files and summarize\" uv run python examples/deploy/github_action_entry.py)",
|
|
12
|
+
"Bash(export GROQ_API_KEY=\"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\")",
|
|
13
|
+
"Bash(curl -s -o /dev/null -w \"%{http_code}\" \"https://pypi.org/pypi/tvastar/json\")",
|
|
14
|
+
"Bash(rm -rf dist)",
|
|
15
|
+
"Bash(uv build *)"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Tvastar Agent
|
|
2
|
+
|
|
3
|
+
# Run a Tvastar agent as a CI job — on demand, or wire it to issues/PRs.
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
inputs:
|
|
7
|
+
prompt:
|
|
8
|
+
description: "What should the agent do?"
|
|
9
|
+
required: true
|
|
10
|
+
default: "List the files in the workspace and summarize the project."
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
run-agent:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v5
|
|
20
|
+
|
|
21
|
+
- name: Install Tvastar
|
|
22
|
+
run: uv pip install --system -e ".[anthropic]"
|
|
23
|
+
|
|
24
|
+
- name: Run agent
|
|
25
|
+
id: agent
|
|
26
|
+
env:
|
|
27
|
+
# Offline-safe default; set TVASTAR_REAL=1 + the secret to use Claude.
|
|
28
|
+
INPUT_PROMPT: ${{ github.event.inputs.prompt }}
|
|
29
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
30
|
+
run: python examples/deploy/github_action_entry.py
|
|
31
|
+
|
|
32
|
+
- name: Show result
|
|
33
|
+
run: |
|
|
34
|
+
echo "Agent finished with: ${{ steps.agent.outputs.stopped }}"
|
|
35
|
+
echo "${{ steps.agent.outputs.result }}"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
|
|
23
|
+
- name: Install (all extras + dev)
|
|
24
|
+
run: uv pip install --system -e ".[all,dev]"
|
|
25
|
+
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: ruff check tvastar/ examples/ tests/
|
|
28
|
+
|
|
29
|
+
- name: Format check
|
|
30
|
+
run: ruff format --check tvastar/ examples/ tests/
|
|
31
|
+
|
|
32
|
+
- name: Tests
|
|
33
|
+
run: pytest -q
|
tvastar-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Tvastar are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/), and the project aims to follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] — 2026-06-04
|
|
10
|
+
|
|
11
|
+
Initial release. Tvastar is a programmable agent harness for Python:
|
|
12
|
+
`Agent = Model + Harness`.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Core harness** — the model↔tool agent loop, `Session`, `Harness`, and
|
|
17
|
+
`create_agent` / `AgentSpec`.
|
|
18
|
+
- **Model layer** — a provider-agnostic `Model` interface with adapters for
|
|
19
|
+
Anthropic (Claude), OpenAI (and any OpenAI-compatible endpoint via `base_url`:
|
|
20
|
+
Cloudflare Workers AI, Groq, Together, Ollama, vLLM, …), and a scripted
|
|
21
|
+
`MockModel` for offline/testing.
|
|
22
|
+
- **Tools** — the `@tool` decorator with automatic JSON-Schema generation from
|
|
23
|
+
type hints, a registry, and a built-in toolset (bash, read/write/edit, list,
|
|
24
|
+
glob, grep).
|
|
25
|
+
- **Sandboxes** — pluggable execution: `VirtualSandbox` (in-memory, runs real
|
|
26
|
+
Python with no Docker), `LocalSandbox` (jailed subprocess), and external
|
|
27
|
+
adapters (`DockerSandbox`, generic `RemoteSandbox` for E2B/Daytona/Modal),
|
|
28
|
+
governed by a `SecurityPolicy`.
|
|
29
|
+
- **Skills** — Markdown-with-frontmatter expertise packages, loaded on demand.
|
|
30
|
+
- **Memory & durable execution** — in-memory and JSON-on-disk stores; full
|
|
31
|
+
transcript + filesystem checkpointing with crash-safe resume.
|
|
32
|
+
- **MCP** — a Model Context Protocol client over stdio (local servers) and
|
|
33
|
+
streamable HTTP/SSE (remote servers); MCP tools mount as native tools.
|
|
34
|
+
- **Failure detection** — in-process detectors for silent failures
|
|
35
|
+
(`unknown_tool`, `schema_mismatch`, `thrash_loop`, `ignored_tool_error`,
|
|
36
|
+
`unverified_completion`, `empty_answer`, `step_limit`), attached to
|
|
37
|
+
`RunResult.findings`.
|
|
38
|
+
- **Observability** — span tracing with console, JSONL, and OpenTelemetry
|
|
39
|
+
exporters.
|
|
40
|
+
- **Serving & deploy** — a CLI (`tvastar chat/serve/run/info`), a FastAPI
|
|
41
|
+
HTTP+WebSocket server, and deploy adapters for ASGI hosts, AWS Lambda,
|
|
42
|
+
GitHub Actions / GitLab CI, and generic FaaS.
|
|
43
|
+
- Examples, a test suite, CI (lint + format + tests on Python 3.10–3.13), and a
|
|
44
|
+
live real-model proof run.
|
|
45
|
+
|
|
46
|
+
[Unreleased]: https://github.com/vanamayaswanth/tvastar/compare/v0.1.0...HEAD
|
|
47
|
+
[0.1.0]: https://github.com/vanamayaswanth/tvastar/releases/tag/v0.1.0
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Contributing to Tvastar
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in improving Tvastar! This guide gets you set up and
|
|
4
|
+
explains the conventions that keep the project small, fast, and reliable.
|
|
5
|
+
|
|
6
|
+
## Quick start
|
|
7
|
+
|
|
8
|
+
Tvastar uses [uv](https://docs.astral.sh/uv/).
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
git clone <your-fork-url>
|
|
12
|
+
cd tvastar
|
|
13
|
+
uv venv
|
|
14
|
+
uv pip install -e ".[all,dev]" # all optional features + test tooling
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Run the test suite and linter:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv run pytest -q # tests (offline, no API keys needed)
|
|
21
|
+
uv run ruff check . # lint
|
|
22
|
+
uv run ruff format . # auto-format
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Everything must be green before you open a pull request.
|
|
26
|
+
|
|
27
|
+
## Project principles
|
|
28
|
+
|
|
29
|
+
These are the rules the codebase is built on. Please keep to them:
|
|
30
|
+
|
|
31
|
+
1. **The core has zero third-party dependencies.** Anything that needs an
|
|
32
|
+
external package (a model SDK, a web server, OpenTelemetry) goes behind an
|
|
33
|
+
optional extra and is imported **lazily, inside a `try/except ImportError`**
|
|
34
|
+
with a helpful message. `import tvastar` must always succeed.
|
|
35
|
+
2. **Nothing observability- or detection-related may break a run.** Tracing and
|
|
36
|
+
failure detectors run in isolation; if they raise, the error is captured, not
|
|
37
|
+
propagated.
|
|
38
|
+
3. **Reliability over strictness.** Helpers degrade gracefully (e.g. the schema
|
|
39
|
+
generator falls back to a permissive schema rather than raising).
|
|
40
|
+
4. **Tests are offline and deterministic.** Use `MockModel` (scripted) and the
|
|
41
|
+
in-memory `VirtualSandbox`. Don't require network or API keys in tests.
|
|
42
|
+
5. **Small, readable, typed.** Match the surrounding style; add type hints and a
|
|
43
|
+
one-line docstring to public functions.
|
|
44
|
+
|
|
45
|
+
## Adding things
|
|
46
|
+
|
|
47
|
+
- **A tool:** decorate a function with `@tool`; the JSON schema is derived from
|
|
48
|
+
its type hints. See `tvastar/tools/builtin.py`.
|
|
49
|
+
- **A model provider:** if it has an OpenAI-compatible endpoint, no code is
|
|
50
|
+
needed — use `OpenAIModel(base_url=...)`. Otherwise subclass `Model` and
|
|
51
|
+
implement `generate()`. See `examples/custom_provider.py`.
|
|
52
|
+
- **A sandbox backend:** implement the `Sandbox` interface. See
|
|
53
|
+
`tvastar/sandbox/`.
|
|
54
|
+
- **A failure detector:** write a function `(RunContext) -> list[Finding]` and
|
|
55
|
+
add it to `default_detectors()` (or document it as opt-in). Keep it
|
|
56
|
+
high-precision — a noisy detector is worse than none. See `tvastar/detect/`.
|
|
57
|
+
|
|
58
|
+
## Pull requests
|
|
59
|
+
|
|
60
|
+
- Keep PRs focused; one logical change per PR.
|
|
61
|
+
- Add or update tests for any behavior change.
|
|
62
|
+
- Update the README if you change public API or add a feature.
|
|
63
|
+
- Describe the motivation, not just the diff.
|
|
64
|
+
|
|
65
|
+
## Reporting bugs
|
|
66
|
+
|
|
67
|
+
Open an issue with a minimal reproduction (ideally using `MockModel` +
|
|
68
|
+
`VirtualSandbox` so it runs anywhere) and what you expected to happen.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
By contributing, you agree that your contributions are licensed under the
|
|
73
|
+
project's [MIT License](LICENSE).
|
tvastar-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 the Tvastar authors
|
|
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.
|