Repository navigation
Trellis v0.1.0
What it is
Trellis is a small, eval-first agent framework (tool-calling loop, LLM planner with a scheduler, tiered memory with hybrid retrieval) in which planning and memory are measured, cost-capped and testable offline. First version: a research prototype, not a production library.
Changes
Added
M0 - scaffold
- Project layout, lint (ruff), type check (mypy), tests with the network disabled, CI on Python 3.11 and 3.12 with actions pinned to commit SHAs.
M1 - agent core
- A single tool-calling loop (
Agent.stream;arunandruncollect it), per-session history,max_steps, failures reported inRunResultinstead of raised. - Tools with JSON Schema from type hints, argument validation, and errors returned to the model.
- Structured trace events and aggregate summaries.
- OpenAI-compatible client (missing
usage, malformed tool arguments and HTTP failures handled) and scripted / rule-based mock models. - Cost accounting from a user-provided price table.
M2 - evaluation and cost control
- Versioned, content-hashed task sets; 11 rule scorers plus an LLM judge; a runner with repeats and concurrency; reports; a baseline regression gate (
compare, exit codes 0 / 1 / 2); a CLI. - Budgets with a hard stop that also counts the call that crossed the line; agent and judge cost reported separately.
M3 - planning and scheduling
- LLM planner whose output is validated (shape, dependencies, cycles, size, worker kinds) and sent back for repair; event-driven scheduler with dependencies, parallelism, retry with backoff, failure policies (skip dependents, fail fast, replan) and budget stops; role-specific workers;
PlannedAgent.
M4 - memory and retrieval
- Working window, episodic and semantic memory, relevance + recency + importance scoring, newer facts superseding older ones, write admission, consolidation and forgetting (methods; not called automatically).
- SQLite FTS5 BM25 retrieval with Chinese segmentation (jieba), an optional vector index, and RRF fusion. Only a deterministic hash embedder is included.
Provider and cost details
- Generic extra request parameters (for example
reasoning_effort) on the client, agent config and CLI;reasoning_tokensrecorded and shown as a share of output. - Prices carry a currency and provenance (source, check date); budgets are an amount plus a currency; per-currency totals are kept apart; conversion only with an FX rate declared in the price file.
--metalabels on the eval CLI, recorded in the report config.
M5 - experiments
- Task sets A (planner, 30 tasks) and B (memory, 20 scripts), fictional data, deterministic scoring, frozen by content hash; v1 to v2 changes after a 19-task pilot are documented, hashes of both kept.
- Resumable full-run driver, full-history reference condition, a generator for the result tables and a supplementary fanout timing run.
Experiment results at a glance
One model (glm-5.3-flash, reasoning_effort=low), fictional data, 5 repeats each, success rate as mean±sd over the repeats. Costs are CNY list-price reference values, not actual spend.
| Experiment | System | Tasks x repeats | Success | Cost (CNY, list) |
|---|---|---|---|---|
| A: planner | single agent | 30 x 5 | 0.987±0.018 | 0.2331 |
| planner | 30 x 5 | 0.993±0.015 | 0.4877 | |
| B: memory | sliding window (150 tokens) | 20 x 5 | 0.400±0.035 | 0.1515 |
| tiered memory | 20 x 5 | 0.980±0.027 | 0.2697 | |
| full history (reference) | 20 x 5 | 0.980±0.027 | 0.2062 |
- On this task set and model the planner brought no measurable accuracy gain (the single agent was already at 0.987, a ceiling) and cost about 2.1 times as much.
- A separate, small timing run on the fanout group only (one task at a time, 3 repeats) found the planner took about 2.1 times as long per task as the single agent (27.36 vs 13.23 s mean). It is not part of the main results.
- On the scripts where a fact falls out of a 150-token window, memory recalled it in 0.986±0.032 of 70 runs (the 14 should-benefit scripts of experiment B, namely allergy 6, deadline 5 and refund-zh 3, times 5 repeats) against 0.171±0.039 for the window on the same 70 runs; full history scored 1.000±0.000, at lower cost than memory on these short conversations. The size of that gap depends on the window size chosen.
- One model, fictional tasks, small samples, no significance tests; read the limitations before drawing conclusions.
Method, full tables and limitations: docs/EXPERIMENTS.md. Every number is in evals/reports/.
Known limitations
This is a research prototype. Features that are not implemented (hooks, guardrails, agent handoff, token streaming, persistent sessions, MCP, a real embedding client, tiered pricing, per-task budgets, reasoning_content pass-back) and the known limitations are listed in docs/ARCHITECTURE.md and Known limitations. Experimental limits (window size, extractor dependence, fictional data, one model) are in the experiments document.