A production-grade, framework-agnostic Python Agent SDK with Bridge and Adapter pattern runtimes.
Project description
Kneo Agent
A production-grade, framework-agnostic Python Agent SDK. Build LLM-powered agents across multiple providers (Google ADK, OpenAI Agents SDK, LangChain) with one consistent API and four execution styles: Bridge, Native, Adapter, and Workflow.
Requirements
- Python 3.12+
- A single mandatory runtime dependency (
PyYAML) - Provider SDKs and OpenTelemetry are optional extras — install only what you need
Installation
pip install kneo-agent # core only
pip install "kneo-agent[openai]" # + OpenAI Agents SDK
pip install "kneo-agent[langchain]" # + LangChain
pip install "kneo-agent[google-adk]" # + Google ADK
pip install "kneo-agent[telemetry]" # + OpenTelemetry middleware
pip install "kneo-agent[all]" # everything above
Verify:
python -c "import kneo_agent; print(kneo_agent.__version__)"
# → 1.5.0
Quick Start
The shortest path is build_sync_agent — no asyncio boilerplate at the
call site:
from kneo_agent import build_sync_agent
agent = build_sync_agent(
"openai",
model="gpt-4o-mini",
system_prompt="You are a helpful assistant.",
)
print(agent.chat("What is 2 + 2?")) # blocks, returns str
Heads-up:
build_sync_agentspins up a fresh event loop viaasyncio.run.SyncAgentraisesRuntimeErrorif invoked from inside an already-running event loop (Jupyter, FastAPI handlers, other async code) rather than silently deadlocking. In those contexts, reach for the asyncbuild_agentinstead.
If you're already inside an event loop (Jupyter, FastAPI handler, other async code), use the async equivalent:
import asyncio
from kneo_agent import build_agent
async def main():
agent = build_agent("openai", model="gpt-4o-mini")
print(await agent.chat("What is 2 + 2?"))
asyncio.run(main())
Both functions accept the same parameters: provider, model, tools,
system_prompt, middlewares, plus a runtime= escape hatch for any
pre-built AgentRuntime. The explicit AgentBuilder + factory chain
remains available for fine-grained control (custom strategies, multi-step
tool registration, workflow composition).
Optional Features
| Feature | Extra | What it adds |
|---|---|---|
| OpenAI Agents SDK runtime | [openai] |
Native gpt-* runtime via openai-agents |
| LangChain runtime | [langchain] |
Bridge over any BaseChatModel |
| Google ADK runtime | [google-adk] |
Adapter wrapping ADK runners |
| OpenTelemetry tracing | [telemetry] |
First-party OpenTelemetryMiddleware emitting GenAI semantic-convention spans |
Built-in capabilities (no extra needed):
- MCP tool servers — import remote tools over
stdio,http, orsseviaMCPServerConfigandToolRegistry.register_mcp_server(...). HTTP / SSE transports support TLS / mTLS / custom CA bundles via theverify=/ca_bundle=/client_cert=/client_key=parameters, plus amax_response_bytescap (10 MiB default) and ansse_read_timeoutinactivity window so a misbehaving server can't exhaust memory or hang the reader. - Skills — package prompt fragments, tool bundles, and defaults into
reusable
Skillobjects (Python orSKILL.mdfiles). - Workflows — sequential, concurrent, handoff, group-chat, and graph
orchestrations. Every workflow satisfies
AgentRuntime, so it can be used as a normalAgentor nested inside another workflow.RetryStepwraps any component with retry-on-failure semantics. - Human-in-the-loop — first-class workflow step with resolver callback or pause/resume semantics.
- Middleware — composable hooks around runs, streams, model calls, and
tool dispatch. The
kneo_agent.middlewaresubpackage ships a production bundle (RetryMiddleware,RateLimitMiddleware,TokenBudgetMiddleware,RedactionMiddleware); the OpenTelemetry middleware is inkneo_agent.observabilityunder the[telemetry]extra. - Secret plumbing —
SecretProviderProtocol withEnvSecretProvider,FileSecretProvider, andMappingSecretProviderso credentials reach tool handlers and MCP transports without leaking into prompts, tool args, or trace spans. - Agent-as-tool — expose any
Agentas a tool that another agent can call (agent.as_tool(...)orToolRegistry.add_agent(...)).
Guide Map
The numbered task guides:
| Guide | Use it for |
|---|---|
docs/user/agent_skills_guide.md |
Loading skills from Python or SKILL.md, discovery, bundled resources, activation payloads |
docs/user/mcp_guide.md |
Importing remote MCP tools over stdio, http, or sse; corporate TLS / mTLS / custom CA |
docs/user/agent_middleware_guide.md |
The four middleware hooks plus the v1.2.0 production bundle (Retry / RateLimit / TokenBudget / Redaction) |
docs/user/human_in_the_loop_guide.md |
Pause / resume / approval steps inside workflows |
The cross-cutting docs added in v1.2.0:
| Doc | Use it for |
|---|---|
docs/user/api_stability.md |
What counts as public surface; the deprecation policy |
docs/user/upgrading_to_1.2.md |
Practical "should I upgrade?" walkthrough from 1.1.x |
docs/user/self_hosted_observability.md |
Wiring OpenTelemetry to OTLP collector / Jaeger / Tempo / SigNoz |
docs/user/offline_install.md |
Air-gapped installs and the no-phone-home audit |
Plus: docs/pub/kneo_agent_api_reference.html /
.pdf — the full public-API reference,
and the architecture / SRS write-ups under docs/dev/ for design-level context.
Cookbook recipes
Runnable patterns under examples/cookbook/:
| Recipe | What it shows |
|---|---|
production_middleware.py |
Composing the four production middlewares (Retry / RateLimit / TokenBudget / Redaction + COMMON_PATTERNS) on a Bridge agent, with cumulative-budget tracking and a billing-period reset() |
local_ollama.py |
Pointing the OpenAI runtime at a local Ollama / vLLM / llama.cpp / LocalAI via base_url= |
workflow_branching_and_retry.py |
Graph workflow combining WorkflowBuilder.add_edge(condition=...) routing with RetryStep resilience |
mcp_server_catalog.py |
Loading a YAML/JSON list of MCPServerConfig entries at app startup |
sql_query_tool.py |
Read-only parameter-bound SQL tool over SQLite (psycopg2 / pymysql / pyodbc swap noted) |
rest_api_tool.py |
Per-host REST tool with auth resolved from a SecretProvider |
object_store_tool.py |
List / get / put against MinIO / on-prem S3 via boto3's endpoint_url= |
search_index_tool.py |
Elasticsearch / OpenSearch query tool with a query-type allow-list |
enterprise_inside_the_firewall.py |
One agent composing a local LLM + internal MCP + read-only SQL + object store + SecretProvider — nothing leaves the network |
otlp_collector_export.py |
Exporting agent traces to an OTLP collector (Jaeger / Tempo / SigNoz); companion to the self-hosted observability guide |
Package Contents
kneo_agent/
├── __init__.py top-level public API exports
├── py.typed PEP 561 typed marker
├── simple.py build_sync_agent / build_agent / SyncAgent
├── core/ Agent, AgentBuilder, RunConfig, types, middleware, skills
├── runtime/ Bridge / Native / Adapter runtime families
├── providers/ OpenAI / LangChain / Google ADK translations
├── workflows/ Sequential / Concurrent / Handoff / GroupChat / Graph + RetryStep
├── patterns/ BridgeAgentFactory, NativeRuntimeFactory, AdapterAgentFactory
├── mcp/ MCP stdio / HTTP / SSE client (with TLS / mTLS support)
├── observability/ OpenTelemetryMiddleware (requires [telemetry])
├── middleware/ Retry / RateLimit / TokenBudget / Redaction bundle
└── utils/ ToolRegistry, SecretProvider + impls, message helpers, logging
For full documentation, examples, the architecture write-up, and the SRS, see the project repository on GitHub.
Community
- Code of Conduct — Contributor Covenant 2.1.
- Security policy — please report vulnerabilities privately, not via the public issue tracker.
- Contributing guide — dev setup, the gates your change must pass, and how PRs are handled.
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 kneo_agent-1.5.0.tar.gz.
File metadata
- Download URL: kneo_agent-1.5.0.tar.gz
- Upload date:
- Size: 90.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20708c4b5c987a6b063f69e44d264f89bc6e17fed15a7701b1242b2e3ce7459e
|
|
| MD5 |
d176cd313a4443b9c1d5e529158c9c89
|
|
| BLAKE2b-256 |
6f4833c6c2d4b9ee0cb2888a01621bef2ca84dc86c485d86d34869ff5d49f675
|
Provenance
The following attestation bundles were made for kneo_agent-1.5.0.tar.gz:
Publisher:
release.yml on kneo-agent/kneo-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kneo_agent-1.5.0.tar.gz -
Subject digest:
20708c4b5c987a6b063f69e44d264f89bc6e17fed15a7701b1242b2e3ce7459e - Sigstore transparency entry: 1708467687
- Sigstore integration time:
-
Permalink:
kneo-agent/kneo-agent@86e8fa071e5e9b0ac461009de0ce48d2131e77ca -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/kneo-agent
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@86e8fa071e5e9b0ac461009de0ce48d2131e77ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file kneo_agent-1.5.0-py3-none-any.whl.
File metadata
- Download URL: kneo_agent-1.5.0-py3-none-any.whl
- Upload date:
- Size: 109.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6783f62de9bfe8770d80312ea82e38a8e2a22da87de28ea70dbe50ae03beb52e
|
|
| MD5 |
077d08f0ce0210477266509be4e62330
|
|
| BLAKE2b-256 |
bee527fa59155f6e7e07e563e17f358350ae312ef35d20ee37a02543930def2a
|
Provenance
The following attestation bundles were made for kneo_agent-1.5.0-py3-none-any.whl:
Publisher:
release.yml on kneo-agent/kneo-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kneo_agent-1.5.0-py3-none-any.whl -
Subject digest:
6783f62de9bfe8770d80312ea82e38a8e2a22da87de28ea70dbe50ae03beb52e - Sigstore transparency entry: 1708467718
- Sigstore integration time:
-
Permalink:
kneo-agent/kneo-agent@86e8fa071e5e9b0ac461009de0ce48d2131e77ca -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/kneo-agent
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@86e8fa071e5e9b0ac461009de0ce48d2131e77ca -
Trigger Event:
push
-
Statement type: