CleverActors — pure Python library for declarative actor definitions: YAML schema, Jinja2 preprocessing, validation, and LangGraph compilation. Extracted from cleveragents-core.
- Python 80.8%
- Gherkin 16.6%
- RobotFramework 2.3%
- Shell 0.3%
|
Some checks failed
CI / lint (pull_request) Successful in 2m28s
CI / quality (pull_request) Successful in 1m52s
CI / security (pull_request) Successful in 3m45s
CI / typecheck (pull_request) Successful in 3m43s
CI / benchmark (pull_request) Has started running
CI / build (pull_request) Successful in 1m25s
CI / integration_tests (pull_request) Successful in 3m49s
CI / unit_tests (pull_request) Successful in 6m5s
CI / coverage (pull_request) Successful in 5m56s
CI / status-check (pull_request) Successful in 25s
CI / lint (push) Successful in 1m47s
CI / typecheck (push) Successful in 2m30s
CI / quality (push) Successful in 2m7s
CI / security (push) Successful in 3m12s
CI / integration_tests (push) Successful in 2m31s
CI / build (push) Successful in 1m42s
CI / unit_tests (push) Successful in 5m43s
CI / coverage (push) Successful in 5m18s
CI / status-check (push) Successful in 23s
CI / benchmark (push) Failing after 18m15s
Adds a self-contained, runnable example under examples/ showing how a host application uses cleveractors-core end-to-end: resolving a `local:` package reference through LocalPackageStore/PackageContentResolver, building an Executor from the resolved graph specification, and running an LLM actor with a skill and tools attached. Includes two alternative, independently valid compositions of the same "Calculator App Builder" actor (agent factored into its own local package vs. inlined directly), the programming-patterns skill package the agent depends on, a CLI harness (test_app.py) to run either in single-shot or interactive mode, and a README documenting prerequisites and exact run steps. The harness normalizes `local:`-prefixed --graph references before resolving them and raises a clear error instead of a raw FileNotFoundError when one is given without --local-store, validates --local-store as a directory in both commands, resolves the LLM server base URL (from LLM_URL or from IP/port/protocol) at a single point shared by both commands instead of threading placeholder sentinel values through the executor-config builder, and applies its LLM request/response logging patch idempotently so repeated turns in an interactive session don't stack duplicate wrappers. Both configurations were verified to resolve and build an Executor without error; the example's Python file passes `ruff check`/ `ruff format --check` and `pyright` (default mode) via its own examples/noxfile.py, kept separate from the library's root noxfile.py. ISSUES CLOSED: #148 |
||
|---|---|---|
| .gitea/workflows | ||
| benchmarks | ||
| docs | ||
| examples | ||
| features | ||
| hooks | ||
| robot | ||
| scripts | ||
| src/cleveractors | ||
| tests | ||
| .bumpversion.cfg | ||
| .copier-answers.base-oss.yml | ||
| .copier-answers.base-python.yml | ||
| .editorconfig | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .semgrep.yml | ||
| asv.conf.json | ||
| ATTRIBUTIONS.md | ||
| behave.ini | ||
| CHANGELOG.md | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| CONTRIBUTORS.md | ||
| LICENSE | ||
| mkdocs.yml | ||
| NOTICE | ||
| noxfile.py | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| README.md | ||
| SECURITY.md | ||
| vulture_whitelist.py | ||
CleverActors
CleverActors is the reactive agent framework used by CleverAgents and CleverRouter.
It provides a Python library that lets a host application:
- Parse CleverAgents v2 YAML configuration files (with Jinja2 templates and
${ENV_VAR}interpolation). - Validate configuration against the built-in schema validator.
- Create reactive agent networks with RxPy streams, LangGraph graphs, or hybrid pipelines of both.
- Run single-shot prompts, interactive CLI sessions, or stream-based
processing via the
ReactiveCleverAgentsApporchestrator.
Install
pip install "cleveractors @ git+https://git.cleverthis.com/cleverlibre/cleveractors@master"
Quick start
from cleveractors import ReactiveCleverAgentsApp
app = ReactiveCleverAgentsApp(config_files=["config.yaml"])
result = await app.run_single_shot("Hello, agents!")
print(result)
For an agent using a non-native provider (anything outside openai/
anthropic/google, e.g. openai_compatible pointed at a custom
base_url), supply credentials so the provider resolves without relying
on environment variables:
app = ReactiveCleverAgentsApp(
config_files=["config.yaml"],
credentials={"openai_compatible": {"api_key": "...", "base_url": "https://..."}},
)
Using agents directly
from cleveractors import Agent
from cleveractors.agents.llm import LLMAgent
agent = LLMAgent(
name="assistant",
config={"provider": "openai", "model": "gpt-4o", "system_prompt": "Be helpful."},
)
response = await agent.process_message("What is 2+2?")
print(response)
LangGraph workflows
from cleveractors.langgraph import LangGraph, Node, NodeType, GraphState
graph = LangGraph(name="my_workflow", config={})
graph.add_node(Node(name="start", node_type=NodeType.AGENT, agent="assistant"))
graph.add_node(Node(name="end", node_type=NodeType.END))
graph.add_edge("start", "end")
result = await graph.execute({"message": "Hello"})
Reactive stream routing
from cleveractors.reactive.stream_router import ReactiveStreamRouter, StreamType
router = ReactiveStreamRouter()
stream = router.create_stream({"name": "pipeline", "type": StreamType.HOT})
router.send_message("pipeline", "Process this message")
Package structure
| Module | Purpose |
|---|---|
cleveractors |
Top-level exports: Agent, ContextManager, ReactiveCleverAgentsApp, CleverAgentsException |
cleveractors.agents |
Agent implementations: LLMAgent, ToolAgent, CompositeAgent, ChainAgent, AgentFactory |
cleveractors.core |
Core framework: ReactiveCleverAgentsApp, ConfigurationManager, ProgressBarManager, exceptions |
cleveractors.langgraph |
LangGraph integration: LangGraph, PureLangGraph, Node, GraphState, StateManager, RxPyLangGraphBridge |
cleveractors.reactive |
RxPy streams: ReactiveStreamRouter, StreamMessage, RouteConfig, ReactiveConfigParser |
cleveractors.templates |
Jinja2+YAML template system: BaseTemplate, TemplateRegistry, AgentTemplate, GraphTemplate, StreamTemplate |
Key exports
from cleveractors import Agent, ContextManager, ReactiveCleverAgentsApp, CleverAgentsException
from cleveractors.core.exceptions import ConfigurationError, TemplateError, RoutingError, ExecutionError
from cleveractors.core.config import ConfigurationManager
from cleveractors.agents.factory import AgentFactory
from cleveractors.langgraph import LangGraph, Node, NodeType, GraphState, StateManager
from cleveractors.langgraph.pure_graph import PureLangGraph, create_pure_langgraph
from cleveractors.reactive.stream_router import ReactiveStreamRouter, StreamType, StreamMessage
from cleveractors.templates import BaseTemplate, TemplateType, TemplateParameter, TemplateRegistry
License
MIT — see LICENSE.
See also CleverAgents Operations Code (CONTRIBUTING) for commit, PR, and testing conventions.