feat: ChainWeaver v0.1.0 — deterministic MCP tool-chain orchestration#1
Merged
feat: ChainWeaver v0.1.0 — deterministic MCP tool-chain orchestration#1
Conversation
- Add chainweaver package (tools, flow, registry, executor, exceptions, logging) - Add examples/simple_linear_flow.py runnable example - Add tests/test_flow_execution.py and tests/test_registry.py (25 tests, all passing) - Add pyproject.toml package configuration - Update README.md with full documentation Co-authored-by: dgenio <12731907+dgenio@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Build production-ready Python library ChainWeaver
feat: ChainWeaver v0.1.0 — deterministic MCP tool-chain orchestration
Mar 3, 2026
There was a problem hiding this comment.
Pull request overview
Introduces ChainWeaver v0.1.0, a small Python library for deterministic orchestration of multi-tool chains (no intermediate LLM calls), with Pydantic-based schema validation, an in-memory flow registry, and a sequential executor with structured step logging.
Changes:
- Adds core library modules:
Tool,Flow/FlowStep,FlowRegistry,FlowExecutor, typed exceptions, and logging helpers. - Adds an end-to-end example script demonstrating a 3-step deterministic flow.
- Adds a pytest suite covering flow registration, intent matching, execution success, and failure modes.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
chainweaver/__init__.py |
Exposes the public API and version. |
chainweaver/tools.py |
Implements the schema-validated Tool abstraction. |
chainweaver/flow.py |
Defines Flow and FlowStep data models. |
chainweaver/registry.py |
Implements an in-memory FlowRegistry with basic intent matching. |
chainweaver/executor.py |
Implements deterministic sequential execution with per-step records. |
chainweaver/exceptions.py |
Adds a typed exception hierarchy for traceable errors. |
chainweaver/logging.py |
Adds structured logging helpers for step start/end/error. |
examples/simple_linear_flow.py |
Demonstrates a “double → add_ten → format_result” flow. |
tests/test_registry.py |
Tests registry behavior (register/get/list/match/overwrite). |
tests/test_flow_execution.py |
Tests successful execution and key failure modes. |
pyproject.toml |
Adds packaging metadata and pytest config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pping, Tool.run()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLM-powered agents commonly insert a model call between every tool invocation to decide the next action. For fully deterministic chains this is pure waste — latency, cost, and token burn with no reasoning value. ChainWeaver eliminates these intermediate calls by compiling known tool sequences into schema-validated execution graphs.
Core abstractions
Tool— callable + Pydantic input/output schemas; validates both directions on every invocationFlowStep— maps keys from the accumulated execution context into a tool's input (string = context lookup, non-string = literal constant)Flow— orderedFlowSteplist;deterministic=Trueby default; optionaltrigger_conditionsmetadata for agent-side dispatchFlowRegistry— in-memory catalogue;register_flow,get_flow,list_flows,match_flow_by_intent(substring, Phase 2 TODO: embedding-based)FlowExecutor— sequential runner; no LLM calls; merges step outputs into a shared context dict; returnsExecutionResultwith per-stepStepRecordlogError handling
Typed exception hierarchy under
ChainWeaverError:ToolNotFoundError,FlowNotFoundError,FlowAlreadyExistsError,SchemaValidationError,InputMappingError,FlowExecutionError— each carrying the step index and tool name for traceability.Usage
Phase 2 design markers
TODOcomments placed throughout for: DAG execution with parallel step groups, conditional branching, determinism scoring, runtime chain observation + flow suggestion, JSON/YAML persistence, async mode, and embedding-based intent matching.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.