feat(public-api): expose all router-facing APIs at cleveractors package level; update README #48
No reviewers
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#17 feat(public-api): expose all router-facing APIs at cleveractors package level; update README
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core!48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/17-public-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR completes Wave C8 (issue #17): finalising the
cleveractorsv2.1.0 public API surface by documenting all router-facing exports inREADME.mdand fixing a pre-existing test-isolation bug in the coverage pipeline.All code changes for C1–C7 (imports,
__all__, version bump, smoke tests) were already merged tomasterin prior commits. This PR delivers the one remaining subtask: the "Router-facing API" README section, plus the bug fix.Changes
README.md— New "Router-facing API" section (AC7)Added a comprehensive "Router-facing API" section after the Quick start block, including:
validate_dict,merge_configs,create_executor,Executor,ActorResult,NodeUsage,ExecutionError,ConfigurationError) with one-line descriptions.merge_configscorrectly described as accepting "zero or more" dicts.create_executorrow updated to "…per-request credentials, and optional execution limits and pricing table" (reflecting the optional parameters).ActorResult.nodes). Includesimport yaml, usesmerge_configsto buildplatform_limits, referencesNodeUsagein the billing loop, and definesactor_yaml_textas a placeholder to avoid an undefined variable reference.create_executorheading updated tocreate_executor(config_dict, credentials, limits=None, pricing=None)to show thatlimitsandpricingare optional.create_executor: "Always passlimitsandpricingin production. When omitted, no execution-limit enforcement is performed. The router MUST pass both on every request per ADR-2024."ActorResultfield list includes all 5 fields:response,prompt_tokens,completion_tokens,nodes, andstate(opaque client-carried graph state for stateless resumption per ADR-2026). Thestateannotation updated todict[str, Any] | None. Thestate=input parameter forexecute()is now documented to complete the round-trip.Executor.execute_stream()andlast_resultbilling, including:last_resultsemantics:timeoutremoved from "Early abandonment" — timeout raisesExecutionError(kind="timeout")and populateslast_resultbefore re-raising.try/except ExecutionErrorblock added to the streaming example showinglast_resultaccess in the except clause.ExecutionError.kind/.reasonreference table with recommended HTTP status codes (ADR-2029:budget_exhausted→ 429,missing_pricing_entry→ 500).cleveractors.templatesrow now lists only actually-exported names (BaseTemplate,GenericTemplate,TemplateType,TemplateParameter,TemplateRegistry,ComponentReference,InstantiationContext) — previously listed non-exportedAgentTemplate,GraphTemplate,StreamTemplate."Package structure" and "Key exports" tables updated to reflect the v2.1.0 surface:
NodeTypeadded to thecleveractors.langgraphrow (previously omitted).TemplateRegistryis now re-exported fromcleveractors.templates.__init__so the Key exports import block is runnable withoutImportError.src/cleveractors/runtime.py—Executor.__init__signature fix + DRY cleanuplimitsandpricingparameters now have matching defaultslimits: dict[str, Any] | None = None, pricing: dict[str, Any] | None = Nonewithor {}substitution inside__init__, matching thecreate_executorfactory signature. This preventsTypeError: missing 2 required positional argumentswhen users constructExecutordirectly (as documented in README's "Exports at a glance" table).if limits is not None and not isinstance(limits, dict)(wasnot isinstance(limits, dict)) —Noneis now accepted and treated as{}.create_executorpreviously didlimits or {}andpricing or {}before passing toExecutor.__init__, which also didlimits or {}andpricing or {}. Theor {}increate_executorhas been removed — allNone-handling now lives exclusively inExecutor.__init__(single source of truth, DRY).self.limits: dict[str, Any]andself.pricing: dict[str, Any]now have explicit class-level annotations per CONTRIBUTING.md mandate.create_executordocstring updated:Args:entries forlimitsandpricingnow include the ADR-2024 warning: "⚠️ Per ADR-2024, the router MUST pass both on every request. Omitting either disables timeout / depth / cost / call-count enforcement."create_executor(config_dict, credentials, limits=None, pricing=None)and note that omittinglimits/pricingdisables all enforcement.src/cleveractors/templates/__init__.py— ExportTemplateRegistry+ sorted__all__Added
TemplateRegistryto the import block and__all__so thatfrom cleveractors.templates import TemplateRegistryworks without raisingImportError.__all__is now sorted alphabetically for consistency with the root-levelcleveractors/__init__.py.features/environment.py— Root logger level, handler level, and handler set test-isolation fixBug:
ReactiveCleverAgentsApp.__init__setslogging.getLogger().setLevel(log_level)globally based on theverboseparameter (verbose=0→ CRITICAL,verbose=1→ ERROR), and also sets each handler's level. Tests that createReactiveCleverAgentsAppcontaminated the logging state for later scenarios in the same slipcover process, causing 5 BDD scenarios inexecute_stream.featureto fail innox -s coverage_report(while passing innox -s unit_testsdue to process isolation differences).Fix (extended): Extended the save/restore to snapshot and restore both the root logger level, all handler levels, AND the handler set itself:
before_scenario: savescontext._root_log_original_level(root logger level),context._root_log_original_handler_levels(list of(handler, level)tuples for all handlers), andcontext._root_log_original_handlers(set of handlers at scenario start).after_scenario: restores all three. Computesset(current_handlers) - set(original_handlers)and removes any handlers added during the scenario (e.g.StreamHandleradded byReactiveCleverAgentsApp.__init__). This makes the workaround fully hermetic against handler addition, not just level mutation. Added# Swallow intentionally: test isolation must not fail the test run.comments to the bareexcept Exception: passblocks per CONTRIBUTING.md guidance.Note: A follow-up issue (#49) has been filed to address the production-side root cause in
ReactiveCleverAgentsApp.__init__(move verbosity logic to a named child loggerlogging.getLogger("cleveractors")instead of mutating the root logger).features/templates_coverage.feature+features/steps/templates_steps.py— New smoke test forTemplateRegistryre-exportAdded BDD scenario verifying that
from cleveractors.templates import TemplateRegistrysucceeds and the imported class is the same object ascleveractors.templates.registry.TemplateRegistry. This follows the same pattern used by other top-level re-export smoke tests (e.g.,execution_limits.feature:32–34).Fixes applied from review:
context: Anyannotations from the three new step functions to match the existing local style intemplates_steps.py(no annotation oncontext).except Exceptiontoexcept ImportErrorinstep_tc_import_template_registryper project convention.(tc)suffix from all three step names (none of them actually conflict with existing steps).features/runtime_coverage.feature+features/steps/runtime_coverage_steps.py— NewExecutor.__init__None-handling testsAdded three BDD scenarios that construct
Executordirectly (not viacreate_executor) to exercise theNone → {}code paths inExecutor.__init__:Executor(config_dict, credentials)— nolimits/pricingkwargs at all → both default to{}Executor(config_dict, credentials, limits=None)— explicitlimits=None→limitsdefaults to{}Executor(config_dict, credentials, pricing=None)— explicitpricing=None→pricingdefaults to{}These complement the existing
create_executor with None limits and pricingscenario, which only exercises the factory path (whereNonewas previously pre-converted before reaching__init__).CHANGELOG.md### Fixed(after the second### Addedheader was removed) have been moved back to### Added. Entries likeExecutor.execute_stream(),create_executor(),ActorResult and NodeUsage types,merge_configs(),validate_dict(),Registry HTTP Client,Registry Client-Side Cache,Per-request credential injection,Structured ExecutionError fields, etc. are all new features, not bug fixes.### Fixedsections: There were two### Fixedsections; they have been merged into one canonical section.ActorResult.stateattributed to ADR-2026).### Fixedentry for the root-logger fix to mention handler set restoration (the fix now restores root logger level, handler levels, AND removes leaked handlers).Quality Gate Results
nox -s lintnox -s typechecklangchain_google_genai)nox -s unit_testsnox -s coverage_reportnox -s integration_testsDesign References
ActorResult.statefor stateless resumption)Known Limitations / Deferred Items
ReactiveCleverAgentsApp.__init__still mutates the root logger level and handler levels globally. The test-side workaround infeatures/environment.pyis now fully hermetic (saves/restores root level, handler levels, AND removes leaked handlers). The production-side fix (moving verbosity logic to a child logger) is tracked in issue #49.Closes #17
14b59ca201203a433120203a43312035ecb8d87535ecb8d875e0625f3cdbe0625f3cdb5776daed1b5776daed1b88ca16e238View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.