Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions examples/00-hello-world/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,12 @@ def route(state: PipelineState) -> str:
async def trace(event: NodeEvent) -> None:
# OpenAIProvider emits NodeEvent-shaped events for LLM-span
# tracking under a sentinel namespace; those have post_state=None.
# Filter to events that carry a state snapshot before reading it.
if event.phase == "completed" and event.error is None and event.post_state is not None:
# Filter to events that carry a PipelineState snapshot before
# reading it. The isinstance check both narrows the type for
# static checkers (post_state is typed as the base State, not
# PipelineState) and acts as a defensive guard against any
# foreign-state observer event the engine might dispatch.
if event.phase == "completed" and event.error is None and isinstance(event.post_state, PipelineState):
print(f"{event.node_name}: sources={event.post_state.sources}")


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ examples = [
packages = ["src/openarmature"]

[tool.pyright]
include = ["src", "tests"]
include = ["src", "tests", "examples"]
pythonVersion = "3.12"
typeCheckingMode = "strict"
reportMissingTypeStubs = false
Expand Down
Loading