A glass-box, minimal library for building LLM agents — modern techniques as opt-in primitives, no hidden control flow.
Project description
glia
A glass-box, minimal library for building LLM agents. Every model call, tool call, and state transition is a plain object you can log, snapshot, and replay. No hidden control flow. The whole loop fits in one file you can read in an afternoon.
glia (n.): the cells that support and connect neurons. This is the connective tissue for LLM agents — not a framework you submit to, a small library you build on.
Python 3.10+ · MIT · zero required dependencies · typed
Why another agent library?
The 2026 agent-framework field is crowded, and the loudest, most consistent complaint about the incumbents is the same: too much abstraction, hidden control flow, painful to debug. Developers keep stripping the framework out to call the model API directly, just to see what's happening.
glia is the opposite bet. It ships the modern techniques — tools, structured outputs, context compaction, durable checkpoints, guardrails, subagents, evals-as-tests — as opt-in primitives you can read, not a monolith you must trust. The design goal is understandability and control, not feature count.
If you want a graph engine, use LangGraph. If you want role-play crews, use CrewAI. If you want a small, transparent loop you fully understand — glia.
See docs/STRATEGY.md for the full market analysis.
Install
pip install glia-agents # core — no dependencies
pip install "glia-agents[anthropic]" # + the Claude provider
The distribution is
glia-agents(the bare namegliawas taken on PyPI); the import staysimport glia. For development:git clonethenpip install -e ".[anthropic,dev]".
30-second tour
import asyncio
from glia import Agent, tool
from glia.providers import ClaudeLLM
@tool
async def get_weather(city: str) -> str:
"""Get the current weather for a city."""
return {"Paris": "18°C, cloudy"}.get(city, "unknown")
async def main():
agent = Agent(ClaudeLLM(), tools=[get_weather], system="Be concise.")
result = await agent.run("What's the weather in Paris?")
print(result.output) # the answer
print(result.usage) # what it cost
asyncio.run(main())
No API key handy? Every example runs offline with the deterministic EchoLLM
provider — same code, no network:
from glia.providers import EchoLLM, call
llm = EchoLLM([call("get_weather", {"city": "Paris"}), "It's 18°C and cloudy."])
See the whole glass box
Because the loop emits an event for everything it does, you can watch it work:
async for event in agent.run_events("What's the weather in Paris?"):
print(event.kind)
# run_started → model_call → model_response → tool_called → tool_returned → model_call → ... → run_finished
And the entire run state is one serialisable object:
from glia.checkpoint import save, load
save(result.trajectory, "run.json") # durable execution: it's just JSON
resumed = load("run.json")
await agent.run("follow-up question", trajectory=resumed) # pick up where you left off
What's in the box
| Primitive | What it gives you |
|---|---|
| Transparent loop | agent.run() / agent.run_events() — no hidden control flow |
| Streaming | Agent(..., stream=True) — tokens arrive as ModelDelta events |
| Typed tools | @tool on a plain function; JSON schema derived from type hints |
| Parallel tools | a turn's tool calls run concurrently, results kept in order |
| Approval gate | approval=... — an inspectable human-in-the-loop verdict before any tool runs |
| Provider boundary | one ~40-line LLM protocol; Claude + offline adapters |
| Trajectory | the full, JSON-serialisable run state and event log |
| Structured output | generate_structured(...) → a dataclass / Pydantic model / dict |
| Context engineering | SummarizingCompactor, TrimmingCompactor |
| Durable execution | checkpoint & resume — a run is a JSON file |
| Guardrails | (text) -> None validators for input and output |
| Subagents | agent.as_tool(...) — any agent becomes a tool |
| Evals-as-tests | a pytest-style regression harness for agent behaviour |
Examples
Runnable, offline, no API key needed:
python examples/01_hello_agent.py # basic agent + event stream
python examples/02_tools.py # tools
python examples/03_structured_output.py # typed output
python examples/04_subagents.py # subagent as a tool
python examples/05_checkpoint_resume.py # durable execution
python examples/06_evals.py # eval suite
python examples/07_streaming_and_approval.py # streaming + parallel tools + approval gate
Design in one picture
Agent.run() → [ call model → (tools? run them, loop) : done ]
│ │
every step emits an Event you can see, log, and replay
│
all state lives in one serialisable Trajectory
Full details in docs/ARCHITECTURE.md.
Project docs
- 📖 Documentation site — full guide, available in English and Русский
- Strategy & market analysis — why glia, and who it competes with
- Architecture — how the whole thing works
- Roadmap — where it's going
- Contributing
Status
v0.2 — alpha. The core thesis is proven end-to-end with a full test suite (110 offline tests, ~98% coverage) and green CI. v0.2 adds streaming, parallel tool execution, and a human-in-the-loop approval gate. APIs may still change before 1.0. Feedback and issues welcome.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glia_agents-0.2.1.tar.gz.
File metadata
- Download URL: glia_agents-0.2.1.tar.gz
- Upload date:
- Size: 64.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c3ac887d82a660afecaa4213d335937690aea71e171a7f9255d1f19af12d0b0
|
|
| MD5 |
30a382085cc59c1ab5542d066f604923
|
|
| BLAKE2b-256 |
6c7764d91eb093094881425badf801d28f5d87e727162268ea153968d4b0ac9d
|
Provenance
The following attestation bundles were made for glia_agents-0.2.1.tar.gz:
Publisher:
publish.yml on DenisDrobyshev/glia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glia_agents-0.2.1.tar.gz -
Subject digest:
7c3ac887d82a660afecaa4213d335937690aea71e171a7f9255d1f19af12d0b0 - Sigstore transparency entry: 2219625843
- Sigstore integration time:
-
Permalink:
DenisDrobyshev/glia@75ea681d3abbb099153fa4bb1d167610846a73b5 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/DenisDrobyshev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@75ea681d3abbb099153fa4bb1d167610846a73b5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file glia_agents-0.2.1-py3-none-any.whl.
File metadata
- Download URL: glia_agents-0.2.1-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a676e6b32a81fb069a2e013024b415cfab916bb8848adb6da2a375bbf21a38d
|
|
| MD5 |
9f85fa256e26b40e12e30501a3957549
|
|
| BLAKE2b-256 |
35e079663d700d34128a06876f9a2d69348cc0c61e5b9fe5bd8a52e4a4433293
|
Provenance
The following attestation bundles were made for glia_agents-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on DenisDrobyshev/glia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glia_agents-0.2.1-py3-none-any.whl -
Subject digest:
0a676e6b32a81fb069a2e013024b415cfab916bb8848adb6da2a375bbf21a38d - Sigstore transparency entry: 2219625868
- Sigstore integration time:
-
Permalink:
DenisDrobyshev/glia@75ea681d3abbb099153fa4bb1d167610846a73b5 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/DenisDrobyshev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@75ea681d3abbb099153fa4bb1d167610846a73b5 -
Trigger Event:
release
-
Statement type: