A lightweight package for multi-expert AI agent routing and state management.
Project description
GentisAI
GentisAI is a small Python package for building multi-expert AI agent POCs with a simple mental model:
Expert + Router + Flow
It is designed for interactive chat, support, sales, copilots, and other workflows where routing should be explicit, fast, and easy to test. GentisAI keeps low orchestration overhead by avoiding hidden manager loops, while still leaving an optional bridge to LangGraph for durable workflows.
Install
pip install gentis-ai
The default install only includes the tiny core and pydantic. Provider SDKs are optional:
pip install "gentis-ai[gemini]"
pip install "gentis-ai[openai]"
pip install "gentis-ai[ollama]"
pip install "gentis-ai[langgraph]"
Quick Start
This example runs offline with no API key.
from gentis_ai import Expert, Flow, Router
from gentis_ai.llm import MockLLM
llm = MockLLM(
routing_rules={
"help": "support",
"buy": "sales",
},
responses={
"help": "I can help troubleshoot that issue.",
"buy": "I can walk you through plans and pricing.",
},
default_response="I can route that to the right expert.",
)
support = Expert(name="support", description="Handles technical support.")
sales = Expert(name="sales", description="Handles sales and pricing.")
router = Router(experts=[support, sales], llm=llm)
flow = Flow(router=router, llm=llm)
response = flow.process_turn(
"I need help with my account.",
session_id="demo-user",
)
print(response.agent_name)
print(response.content)
Core Concepts
Expert: a persona with a name, description, optional system prompt, and optional tools.Router: selects one or more experts and returns a validatedRoutingDecision.Flow: manages routing, session history, expert execution, streaming events, and responses.SessionStore: stores state in memory or SQLite.BaseLLM: provider-neutral interface for mock, Gemini, Ollama, Bedrock, and OpenAI-compatible adapters.
Structured Routing
Router.classify() returns a RoutingDecision:
decision = router.classify("I want pricing help", "orchestrator")
print(decision.experts)
print(decision.confidence)
Older code can use router.classify_names(...) to get a list[str].
For zero-LLM routing, pass deterministic rules:
router = Router(
experts=[support, sales],
llm=None,
rules={"help": "support", "buy": "sales"},
)
Sessions
Use explicit session_id values in production so users do not share state:
response = flow.process_turn("hello", session_id="customer-123")
SQLite persistence is built in:
from gentis_ai import SQLiteSessionStore
flow = Flow(
router=router,
llm=llm,
session_store=SQLiteSessionStore("gentis.db"),
)
Anonymous calls are allowed, but each call receives a fresh anonymous session.
Streaming
Core runtime does not print. Use stream_turn() and decide how your app displays events:
for event in flow.stream_turn("Tell me a story", session_id="demo"):
if event.type == "token":
print(event.content, end="", flush=True)
elif event.type == "final":
print()
Async variants are available:
response = await flow.aprocess_turn("hello", session_id="demo")
async for event in flow.astream_turn("hello", session_id="demo"):
...
Providers
All provider adapters implement the same BaseLLM contract.
from gentis_ai.llm import OpenAICompatibleLLM
llm = OpenAICompatibleLLM(
model_name="gpt-4o-mini",
api_key="...",
base_url="https://api.openai.com/v1",
)
Helpful extras:
- Gemini:
pip install "gentis-ai[gemini]" - OpenAI-compatible and Azure:
pip install "gentis-ai[openai]" - AWS Bedrock:
pip install "gentis-ai[bedrock]" - Ollama:
pip install "gentis-ai[ollama]" - LangGraph bridge:
pip install "gentis-ai[langgraph]"
See examples/cloud_providers_example.py for provider selection by environment variable.
Tools
GentisAI includes reusable tool schema, registry, and executor primitives:
from gentis_ai.tools import ToolExecutor, ToolRegistry
def add(a: int, b: int) -> int:
return a + b
registry = ToolRegistry()
registry.register(add)
executor = ToolExecutor(registry, approval_policy={"delete_file": "always"})
result = executor.execute("add", {"a": 2, "b": 3})
LangGraph Bridge
GentisAI stays simple by default. Use LangGraph when you need checkpointed, durable, multi-node workflows:
from gentis_ai.adapters.langgraph import to_langgraph
graph = to_langgraph(flow)
import gentis_ai never imports LangGraph.
CLI
gentis new support-agent
gentis run
gentis eval
gentis bench
Documentation And Examples
docs/getting-started.mddocs/api-reference.mddocs/features/streaming.mdexamples/quick_mock_start.pyexamples/cloud_providers_example.pybenchmarks/README_comparison.md
Development
pip install -e ".[dev]"
python -m pytest
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 gentis_ai-0.2.0.tar.gz.
File metadata
- Download URL: gentis_ai-0.2.0.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
124ac08ee4c8e4b0c32fa7360a8ef3be0e25a1917a1e684fbcdccb2360e051fb
|
|
| MD5 |
8d8696bf94fcd13a6380cf0c3a791bd2
|
|
| BLAKE2b-256 |
4a0e391cbd6889f20aff2460699a10ace10f225f809205978e23945327df7c88
|
Provenance
The following attestation bundles were made for gentis_ai-0.2.0.tar.gz:
Publisher:
publish.yml on GhaouiYoussef/GentisAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gentis_ai-0.2.0.tar.gz -
Subject digest:
124ac08ee4c8e4b0c32fa7360a8ef3be0e25a1917a1e684fbcdccb2360e051fb - Sigstore transparency entry: 2060750224
- Sigstore integration time:
-
Permalink:
GhaouiYoussef/GentisAI@08a7678aece74ad183c57807b60b31a75299c838 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/GhaouiYoussef
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08a7678aece74ad183c57807b60b31a75299c838 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gentis_ai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: gentis_ai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 48.7 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 |
c9c2a090ee8fecaf92a3d39924a9fb826c4d3e3e555e144b43b5c95621b7439a
|
|
| MD5 |
89082a2fe1ed6c20c31aa8b9be04b953
|
|
| BLAKE2b-256 |
8680d7bb9ee4b9ef9a5226bb443cedf17cd57372513a87642bdc1fb7953763cf
|
Provenance
The following attestation bundles were made for gentis_ai-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on GhaouiYoussef/GentisAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gentis_ai-0.2.0-py3-none-any.whl -
Subject digest:
c9c2a090ee8fecaf92a3d39924a9fb826c4d3e3e555e144b43b5c95621b7439a - Sigstore transparency entry: 2060750690
- Sigstore integration time:
-
Permalink:
GhaouiYoussef/GentisAI@08a7678aece74ad183c57807b60b31a75299c838 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/GhaouiYoussef
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08a7678aece74ad183c57807b60b31a75299c838 -
Trigger Event:
release
-
Statement type: