Skip to content

Releases

Trellis v0.2.0

Choose a tag to compare

@xtong629 xtong629 released this 19 Nov 19:21
9978862

What it is

Trellis is a small Python agent framework built around measurement: versioned, content-hashed task sets, rule and LLM-judge scorers, a regression gate, and cost accounting with hard budgets. It is a research prototype, not a production library. Everything runs offline with mock models; the experiments ran on one real model (glm-5.3-flash, reasoning_effort=low) with fictional data.

What's new in 0.2.0

  • Reflection (trellis_agent.reflect): ReflectingAgent wraps an Agent. After a final answer, a checker reviews it against the task and the tool results. If the checker rejects it, the agent retries once with the reason. Every check and retry is counted in usage, cost and trace. It is opt-in; the default Agent is unchanged. See examples/06_reflection.py.
  • Judge calibration statistics (trellis_agent.eval.calibrate): 2x2 counts, agreement rate, Cohen's kappa and a seeded bootstrap interval.
  • Three pre-registered experiments (C1, C2, C4). For each, the hypothesis and decision rule were merged before any real model call. Each runs on a new frozen task set or answer set, and the trial reports are kept. The v0.1.0 task sets and results are unchanged.
  • A recorded terminal demo (docs/demo/), made with mock models.

Results at a glance

Full method, tables and limits: docs/EXPERIMENTS_V02.md. Costs are CNY list-price reference values, not actual spend.

  • C1, reflection: not run as designed.
    • The baseline hit the ceiling: 1.000±0.000 on benefit tasks. As pre-registered, the hypothesis was not decided.
    • The reflection arm scored 0.978±0.030, at a cost of 0.3133 vs 0.2538 CNY (about 1.23x). The checker made 2 fixes and 2 harms.
    • Both harms trace to an ambiguous wording in the frozen tasks. The ambiguity is disclosed, and the tasks were not changed.
  • C2, planner under simulated tool latency: supported, only at 10 s.
    • At 10 s the planner's median was 34.50 vs 48.87 s per task (ratio 0.71). It was not faster at 1 s (1.47) or 4 s (0.95).
    • There were 3 repeats per cell, and the planner cost 2.2-3.1x as much.
    • With 30% transient tool failures, neither system was clearly better.
  • C4, LLM judge vs rule scorers: supported, within narrow bounds.
    • The judge and the rules agreed on 839 of 840 answers (kappa 0.992, CI 0.974-1.000).
    • There are no human labels, and the judge is the same model as the one under test.
    • The answers come from simple tasks that rules can decide.

Known limitations

  • One model, one reasoning level, fictional tasks and small samples; no significance tests.
  • Reflection's benefit was not shown. The checker can reject right answers, and a PlannedAgent cannot be wrapped.
  • C2's latency is a simulated asyncio.sleep, not real tools. Latencies between 4 and 10 s were not tested.
  • Not implemented: hooks, guardrails, agent handoff, token streaming, persistent sessions, MCP, a real embedding client, and calls to forgetting from the agent loop. See docs/ARCHITECTURE.md and the CHANGELOG.

Trellis v0.1.0

Choose a tag to compare

@xtong629 xtong629 released this 18 Nov 16:13
389e349

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; arun and run collect it), per-session history, max_steps, failures reported in RunResult instead 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_tokens recorded 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.
  • --meta labels 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.