Hajimi Agent
Hajimi is a small async-first Python agent framework built around
any-llm-sdk direct async APIs.
Core capabilities:
- TOML and
.envbased configuration. - Loguru console and rotating file logging.
- Async completion, streaming completion, embedding, and Responses API wrappers.
- A typed core with message parts, stream events, context objects, and a compact agent loop with optional tool dispatch.
- Workspace read/search tools, opt-in write/shell tools, local skills with progressive activation, optional MCP tools, BM25 tool search, agent-as-tool subagents, and persistent in-process teammates.
- Durable
AgentSessioncontext with JSONL events, SQLAlchemy ORM indexes defaulting to SQLite, forks, edit/delete/restore markers, compaction, and token reports with optional provider cache usage. - JSONL tracing with optional OpenTelemetry export.
- Pytest coverage for configuration, logging, LLM wrappers, tools, skills, MCP, sessions, tracing, subagents, teammates, workspace tools, and dynamic tool search.
Quick start:
uv sync
cp examples/configs/.env.example examples/configs/.env
export HAJIMI_API_KEY=...
export HAJIMI_BASE_URL=https://api.deepseek.com
export HAJIMI_MODEL=deepseek-chat
uv run hajimi chat "hi"
uv run python examples/basic_agent.py
uv run pytest -q
CLI:
hajimi chat "hi"
hajimi chat --json "hi"
hajimi agent models --json
hajimi tool list
hajimi mcp list
hajimi skill list
Examples:
uv run python examples/basic_agent.py
uv run python examples/stream.py
uv run python examples/tools.py
uv run python examples/custom_loop.py
uv run python examples/session.py
uv run python examples/routed_runtime.py
uv sync --extra mcp
uv run python examples/mcp_stdio.py
Minimal one-call usage (no TOML required):
# Export at least one provider key, e.g.:
# export HAJIMI_API_KEY=... # overrides the selected configured model
# export HAJIMI_BASE_URL=... # optional provider endpoint
# export HAJIMI_MODEL=deepseek-chat # optional model id override
# export OPENAI_API_KEY=... # auto-detected as the openai default
# export DEEPSEEK_API_KEY=... # auto-detected as the deepseek default
# export HAJIMI_DEFAULT_MODEL=openai # optional, when several keys are set
from hajimi import Hajimi
print(await Hajimi.ask("hello"))
Typed core API:
from hajimi import TextDelta, user_message
async with agent.run_stream([user_message("hello")]) as run:
async for event in run:
if isinstance(event, TextDelta):
print(event.chunk, end="")
print(run.output)
Custom loop API:
from collections.abc import AsyncIterator
import hajimi as ai
class CustomAgent(ai.Agent):
async def loop(self, context: ai.Context) -> AsyncIterator[ai.AgentEvent]:
while context.keep_running():
async with (
ai.stream(context=context) as stream,
ai.ToolRunner() as tools,
):
async for event in ai.merge(stream, tools.events()):
yield event
if isinstance(event, ai.ToolEnd):
tools.schedule(context.resolve(event.tool_call))
context.add(stream.message)
context.add(tools.get_tool_message())
Power-user knobs travel on a single RunOptions object:
from hajimi import AgentRuntime, RunOptions, load_config
runtime = await AgentRuntime.from_config(await load_config())
result = await runtime.run_task(
"draft a release note for v0.2",
options=RunOptions(
mode="auto",
max_cost_usd=0.05,
max_total_tokens=8000,
on_budget_exceeded="stop",
),
)
print(result.content, result.cost)
Optional extras:
uv sync --extra mcp
uv sync --extra observability
Docs:
Metadata
Release files for hajimi 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hajimi-0.1.1.tar.gz | 1.1 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hajimi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / hajimi-0.1.1.tar.gz
| Download URL | hajimi-0.1.1.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fdac55c504809913c6afb71df88e52fe90a6c332eaad57ece50c1cd9afb298c
|
|
BLAKE2b-256 checksum How to use checksums |
45f320f04d9347a1eafa7ef06d0c5596e6f114e695951b77a5dc0f74c4e36f9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / hajimi-0.1.1-py3-none-any.whl
| Download URL | hajimi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 177.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76d9bb4ec712bdaf21897f1d0aaf303b5350dc6a3bb30ff6c64015406e4f69ff
|
|
BLAKE2b-256 checksum How to use checksums |
7d754d04eb6e3ccc6274932f44b4400c82109cb97bccd4180101c22e81a616e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Security for hajimi 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.