Public Ellements primitives for LLM calls, execution strategies, finite-state linguistic machines, benchmarking, and CLI presentation.
Project description
Ellements
A Python toolkit for extreme experimentation with LLM systems.
Ellements is best understood as a continuously extended set of building
blocks for LLM experimentation: model clients, prompt context, execution
strategies, agent abstractions, benchmarking harnesses, and terminal UI
primitives. The repository is organized into focused source roots, but ships as
a single PyPI package, ellements, containing every public ellements.*
subpackage.
[!WARNING] Do not treat this as a normal dependency. This repository exists to support my own projects, experiments, and tooling. Probably nobody other than me should depend on it directly.
[!NOTE] Almost all of it is created with AI assistance, and I myself understand only a fraction of it at any given time. This can produce fast-paced changes, as well as both good and bad surprises. Pull requests are unlikely to be accepted. This is published for transparency and my own reuse, not as a community-maintained library or a general-purpose package roadmap.
Why yet another LLM library?
True, there are many other similar libraries. This one, however, is mine. It exists so I can keep extending it, test ideas, change direction, delete abstractions, and rebuild APIs as I see fit: not by committee, not by roadmap, not by community consensus.
Design principles
The practical consequences are the following:
- One install, focused internals.
pip install ellementsinstalls the full namespace:ellements.core,ellements.execution,ellements.agents,ellements.benchmarking,ellements.cli,ellements.domain_specific,ellements.reporting,ellements.standard_tools, andellements.fslm. - Extension before stabilization. The point is to keep adding mechanisms as they become useful in my projects. Stability comes later, if it comes at all.
- Async-only public API. No hidden sync wrappers. Callers keep explicit control of concurrency.
- Explicit model selection.
LLMClient(model=...)is required. There is no hidden default. - Structured observability. Every LLM call emits request, response, and
error events.
JsonlPromptLoggerwrites durable JSON-lines traces. - Composable strategy layer. Single-call, reflection, self-consistency,
tree-of-thought, and collaborative editing all conform to one
Strategyprotocol. - Backend-agnostic agents.
ellements.agentsis an abstraction layer over external agent libraries. OpenAI Agents and Claude Agents are adapters; they are not the identity of the module. - Finite-state linguistic machines.
ellements.fslmkeeps agentic workflows bounded by explicit state graphs while still allowing natural-language guards, invariants, actions, and outputs where they are useful. TheLis deliberate: language is part of the control surface, not a decorative interface.
Install
pip install ellements
Optional extras install integration-specific dependencies. They do not split the package or change which modules ship in the wheel.
pip install "ellements[agents]" # declared agent-adapter dependencies
pip install "ellements[benchmarking]" # lm-eval integration
pip install "ellements[cli]" # Textual-powered terminal UI helpers
pip install "ellements[fslm]>=0.2.0" # finite-state linguistic machines
pip install "ellements[finance]" # Yahoo Finance asset tools
pip install "ellements[web]" # web search, crawl, and YouTube tools
pip install "ellements[reporting]" # chart/report export helpers
pip install "ellements[all]" # all declared optional integrations
In particular, the agents module is not OpenAI-specific. It defines shared builder, controller, runner, and event abstractions over external agent libraries. The OpenAI adapter has declared optional dependencies; the Claude adapter is included in the wheel, but its upstream SDK is still evolving, so install it separately when using that backend.
What ships
| Import package | Purpose |
|---|---|
ellements.core |
LLMClient, conversations, multimodal inputs, tools, prompt context, templating, observers, caching, rate limiting, budgeting, and config helpers |
ellements.execution |
Prompting strategies: SingleCallStrategy, ReflectionStrategy, SelfConsistencyStrategy, TreeOfThoughtStrategy, CollaborativeEditingStrategy |
ellements.agents |
Backend-agnostic layer over external agent libraries: runner, controller, fluent AgentBuilder, event surface, and OpenAI/Claude adapters |
ellements.benchmarking |
Async benchmark harnesses, model runners, dataset adapters, and comparison helpers |
ellements.cli |
Terminal presentation primitives, agent TUI components, and slash-command building blocks |
ellements.domain_specific |
Domain tools, currently including finance calculators, Yahoo Finance asset data, valuation, technical indicators, and risk helpers |
ellements.reporting |
Chart artifacts, HTML report generation, and multi-format presentation helpers |
ellements.standard_tools |
Reusable tool surfaces for terminal execution, web search, web crawl/read, and YouTube search/transcript access |
ellements.fslm |
Finite-state linguistic machines: explicit graphs, deterministic kernel, natural-language evaluators, persistence, observers, and fslm CLI |
Quick start
import asyncio
from ellements.core import JsonlPromptLogger, LLMClient
async def main() -> None:
client = LLMClient(
model="openai/gpt-5.5",
observers=[JsonlPromptLogger("./logs")],
)
answer = await client.complete("Explain attention in one paragraph.")
print(answer)
asyncio.run(main())
Run a strategy
from ellements.execution import ReflectionConfig, ReflectionStrategy
strategy = ReflectionStrategy()
result = await strategy.execute(
prompts={
"generate": "Draft a haiku about distributed systems.",
"critique": "Review this draft and return a CritiqueResult:\n\n{{response}}",
"revise": (
"Revise the draft using the issues below.\n\n"
"Draft:\n{{response}}\n\nIssues:\n{{issues}}"
),
},
client=client,
config=ReflectionConfig(max_rounds=3),
)
print(result.output)
Runtime strategy templates accept both Mustache placeholders such as
{{response}} and PromptSpec-style placeholders such as @{response}.
Build an agent
OpenAI is shown here as one concrete adapter; the builder targets the
backend-agnostic AgentBackend protocol.
from ellements.agents import AgentBuilder, OpenAIAgentsBackend
agent = (
AgentBuilder("researcher", backend=OpenAIAgentsBackend())
.with_model("gpt-4.1")
.with_instructions("Research carefully, cite evidence, and be concise.")
.with_tool("search", my_search_tool)
.build()
)
Use finance and web tools
Finance and web tools expose canonical ToolRegistry surfaces, so LLM clients,
agents, and PromptSpec examples can bind the same tools without local adapters.
pip install "ellements[finance,web]"
playwright install chromium # required by crawl4ai-backed page crawling
from ellements.domain_specific.finance.yahoo_finance import finance_tools
from ellements.standard_tools.web.crawler import web_crawler_tools
from ellements.standard_tools.web.search import web_search_tools
tools = (
finance_tools()
.merge(web_search_tools())
.merge(web_crawler_tools(max_content_tokens=4000))
)
print(sorted(tools))
Typical stock-research tools include search_asset, get_asset_quote,
get_asset_profile, get_financial_metrics, search_web, search_news, and
crawl_url.
Packaging model
The repo is modular at the filesystem level:
ellements-core/src/ellements/core
ellements-execution/src/ellements/execution
ellements-agents/src/ellements/agents
ellements-benchmarking/src/ellements/benchmarking
ellements-cli/src/ellements/cli
ellements-domain-specific/src/ellements/domain_specific
ellements-fslm/src/ellements/fslm
ellements-reporting/src/ellements/reporting
ellements-standard-tools/src/ellements/standard_tools
Those source roots are discovered into a single wheel,
ellements-<version>-py3-none-any.whl. Users install one PyPI project and
import the modules they need:
from ellements.core import LLMClient
from ellements.domain_specific.finance.yahoo_finance import finance_tools
from ellements.execution import TreeOfThoughtStrategy
from ellements.agents import AgentBuilder
from ellements.fslm import FSLMKernel
from ellements.standard_tools.web.search import web_search_tools
This gives the repo clean internal boundaries without creating multiple PyPI entries to publish, document, secure, and maintain.
Local development
pip install -e ".[dev,all]"
python -m pytest -q
python -m ruff check .
python -m mypy --strict ellements-core/src ellements-execution/src \
ellements-agents/src ellements-benchmarking/src ellements-cli/src \
ellements-domain-specific/src ellements-fslm/src ellements-reporting/src \
ellements-standard-tools/src
License
MIT, with the project status and maintenance notice in 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 ellements-0.2.0.tar.gz.
File metadata
- Download URL: ellements-0.2.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fba2af88e2fca0ce30341da8dc340d2a311a89f02b1be714c4de11b87af60c97
|
|
| MD5 |
abac016541354c534201ebffe56f7ea4
|
|
| BLAKE2b-256 |
55356e5e0f1f3361cb60025e8933b1156305a2a005244b1b763ff33b39f57a08
|
File details
Details for the file ellements-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ellements-0.2.0-py3-none-any.whl
- Upload date:
- Size: 253.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e0cebeaa9080c5feddee835e29e82b4162744dc3b56fa6288a95adca80b9e12
|
|
| MD5 |
2ae2c290badee017909df1f4ffb67db1
|
|
| BLAKE2b-256 |
1a8eb856c2dd1a41909c18c0119890b333a69464fe79f9f1fff502ffabece39e
|