CoreRasurae 00e5482242
CI / lint (pull_request) Successful in 49s
CI / typecheck (pull_request) Successful in 2m7s
CI / quality (pull_request) Successful in 2m3s
CI / security (pull_request) Successful in 2m13s
CI / build (pull_request) Successful in 2m21s
CI / integration_tests (pull_request) Successful in 3m28s
CI / unit_tests (pull_request) Successful in 5m31s
CI / coverage (pull_request) Successful in 5m32s
CI / status-check (pull_request) Successful in 7s
CI / benchmark (pull_request) Has been cancelled
CI / lint (push) Successful in 53s
CI / quality (push) Successful in 53s
CI / typecheck (push) Successful in 1m34s
CI / build (push) Successful in 1m44s
CI / integration_tests (push) Successful in 2m42s
CI / unit_tests (push) Successful in 4m50s
CI / coverage (push) Has been skipped
CI / status-check (push) Failing after 9s
CI / benchmark (push) Has been cancelled
CI / security (push) Successful in 2m19s
feat(agents): expose sandboxed file helpers to inline code
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.

Per ADR-2035 D-7 (this correction), read_file and write_file are now always
bound in every inline-code body and gated solely by safe_mode: read_file is
confined to the sandbox root and write_file is refused unconditionally when
safe_mode is true (the default); both are unrestricted when safe_mode is
false. The _unsafe_mode context flag no longer participates in this
decision (it is unaffected everywhere else, including the file_write tool).

FileAccessCore.read_window/write now accept a keyword-only confine: bool =
True parameter. When true (the default), the method resolves path through
the root policy itself before touching disk. The inline-code read_file
closure passes confine=safe_mode; write_file passes confine=False (it only
reaches the core after safe_mode has already refused); the built-in
_file_read_tool/_file_write_tool pass confine=False, since they perform
their own admission checks that intentionally permit escaping the sandbox
root in the tools' own unsafe mode. Any caller that reaches the core without
specifying confine -- including via closure introspection -- now lands on
the safe default.

The Actor Configuration Standard is revised to 1.4.0 (§4.5.2, §13.2.1,
§13.2.3, §13.3) recording the sanctioned helpers, with the rationale in the
ADR.

ISSUES CLOSED: #93
2026-08-07 17:26:02 +01:00
2026-05-26 21:45:54 +01:00
2026-05-26 21:45:54 +01:00
2026-05-26 21:45:54 +01:00
2026-05-26 21:45:54 +01:00

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 ReactiveCleverAgentsApp orchestrator.

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.

S
Description
CleverActors — pure Python library for declarative actor definitions: YAML schema, Jinja2 preprocessing, validation, and LangGraph compilation. Extracted from cleveragents-core.
Readme 8.2 MiB
Languages
Python 81.1%
Gherkin 16.5%
RobotFramework 2.1%
Shell 0.3%