feature/m1-inline-code-sandboxed-file-access
CI / typecheck (pull_request) Successful in 1m23s
CI / lint (pull_request) Successful in 1m45s
CI / quality (pull_request) Successful in 1m48s
CI / security (pull_request) Successful in 2m12s
CI / build (pull_request) Successful in 1m30s
CI / integration_tests (pull_request) Successful in 4m43s
CI / unit_tests (pull_request) Successful in 5m43s
CI / coverage (pull_request) Failing after 14m25s
CI / benchmark (pull_request) Failing after 19m12s
CI / status-check (pull_request) Failing after 10s
Inline-code tool bodies (§4.5.2) could not read or write file contents dynamically: the §13.2.1 sandbox exposes no filesystem access, so the only sanctioned path was static file_read → inline → file_write wiring, which cannot express a runtime-computed path, multi-file access, or a read-modify-write cycle in one body. Per ADR-2035, expose exactly two injected local callables in unsafe mode: read_file(path, max_chars=None, offset=0) -> str write_file(path, content, mode="w") -> int Both reuse the existing file_read/file_write validated cores (now extracted into a shared FileAccessCore + SandboxRootPolicy so containment, ADR-2033 windowing, and the §4.5.5 write modes have a single implementation) and return raw values rather than the LLM envelope. They confine every access to the sandbox root — rejecting `..`, `~`, and any path whose resolved real path (symlinks followed) escapes the root — raising ValueError so inline code can catch it with the sandbox's own vocabulary. write_file additionally requires _unsafe_mode in the invocation context; read_file does not, preserving the read/write privilege split. In safe mode neither name is bound (NameError), and the §13.2.1 built-in table is unchanged. The shared realpath containment also closes a symlink-escape gap in the built-in tools. The Actor Configuration Standard is revised to 1.2.0 (§4.5.2, §13.2.1, §13.2.3, §13.3) recording the sanctioned helpers, with the rationale in the ADR. Refs: #93 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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)
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.
Description
CleverActors — pure Python library for declarative actor definitions: YAML schema, Jinja2 preprocessing, validation, and LangGraph compilation. Extracted from cleveragents-core.
Languages
Python
81.2%
Gherkin
16.4%
RobotFramework
2.1%
Shell
0.3%