neurocore.runtime.executor¶
Blueprint executor — wires skills into FlowEngine and runs them.
The executor is the bridge between NeuroCore’s skill system and FlowEngine’s execution engine. It:
Resolves skill names from the blueprint to Skill classes via the registry
Merges config: neurocore.yaml skills.<name> (base) + blueprint config (overlay)
Creates and initializes Skill instances
Builds a FlowEngine FlowConfig and component dict
Executes via FlowEngine (sync or async)
- Usage:
from neurocore.runtime import execute_blueprint, load_and_run
# Low-level result = execute_blueprint(blueprint, registry, config)
# High-level (load + discover + execute) result = load_and_run(blueprint_path, project_root=Path(“.”))
# Streaming async for event in execute_blueprint_stream(bp, registry, cfg):
print(event.event_type, event.step_name)
Attributes¶
Functions¶
|
Merge skill configuration from neurocore.yaml and blueprint. |
|
Execute a blueprint. Supports both sync and async skills. |
Execute a blueprint, yielding FlowEvents as each step runs. |
|
|
High-level function: load config, discover skills, execute blueprint. |
Module Contents¶
- neurocore.runtime.executor.log¶
- neurocore.runtime.executor.merge_skill_config(neurocore_config: neurocore.config.schema.NeuroCoreConfig, skill_name: str, blueprint_config: dict[str, Any]) dict[str, Any][source]¶
Merge skill configuration from neurocore.yaml and blueprint.
- Priority (highest wins):
Blueprint component config (overlay)
neurocore.yaml skills.<name> (base)
- Parameters:
neurocore_config – The project’s NeuroCoreConfig.
skill_name – The skill’s registered name (for neurocore.yaml lookup).
blueprint_config – Config from the blueprint’s component definition.
- Returns:
Merged config dict.
- neurocore.runtime.executor.execute_blueprint(blueprint: neurocore.runtime.blueprint.Blueprint, registry: neurocore.skills.registry.SkillRegistry, neurocore_config: neurocore.config.schema.NeuroCoreConfig, *, initial_data: dict[str, Any] | None = None) flowengine.FlowContext[source]¶
Execute a blueprint. Supports both sync and async skills.
This is the core execution function. It: 1. Validates skill references 2. Creates and initializes skill instances with merged config 3. Detects async skills and chooses execution path 4. For sync-only blueprints, delegates to FlowEngine 5. For async blueprints, uses asyncio event loop
- Parameters:
blueprint – Parsed Blueprint.
registry – SkillRegistry with discovered skills.
neurocore_config – Project configuration.
initial_data – Optional initial context data (key-value pairs).
- Returns:
FlowContext with execution results.
- Raises:
BlueprintError – If validation or instantiation fails.
ExecutionError – If execution fails.
- async neurocore.runtime.executor.execute_blueprint_stream(blueprint: neurocore.runtime.blueprint.Blueprint, registry: neurocore.skills.registry.SkillRegistry, config: neurocore.config.schema.NeuroCoreConfig, initial_data: dict[str, Any] | None = None) collections.abc.AsyncIterator[Any][source]¶
Execute a blueprint, yielding FlowEvents as each step runs.
- Usage:
- async for event in execute_blueprint_stream(bp, registry, cfg):
print(event.event_type, event.step_name)
- neurocore.runtime.executor.load_and_run(blueprint_path: pathlib.Path, *, project_root: pathlib.Path | None = None, initial_data: dict[str, Any] | None = None) flowengine.FlowContext[source]¶
High-level function: load config, discover skills, execute blueprint.
Convenience wrapper that does everything: 1. Load neurocore.yaml config 2. Discover all skills (directory + entry points) 3. Load and parse the blueprint 4. Execute via FlowEngine
- Parameters:
blueprint_path – Path to the blueprint YAML file.
project_root – Optional project root (auto-detected if not provided).
initial_data – Optional initial context data.
- Returns:
FlowContext with execution results.