Skip to content

Phase 2: Developer Experience (v0.2.0)#27

Merged
jkbennitt merged 21 commits into
mainfrom
dev/phase-2
Mar 21, 2026
Merged

Phase 2: Developer Experience (v0.2.0)#27
jkbennitt merged 21 commits into
mainfrom
dev/phase-2

Conversation

@jkbennitt
Copy link
Copy Markdown
Member

Summary

Phase 2 adds developer experience features to the Felix Agent SDK. Zero breaking changes to v0.1.0 API.

What's new

  • Event SystemEventBus with pub/sub, FelixEvent, EventType enum, EventEmitterMixin. Wired into FelixWorkflow, LLMAgent, CentralPost.
  • Structured Loggingconfigure_logging(), JSON/text formatters, EventLogBridge for automatic event-to-log bridging.
  • StreamingStreamHandler, StreamAccumulator, LLMAgent.process_task_streaming() with token-level events.
  • Dynamic SpawningConfidenceMonitor, ContentAnalyzer, DynamicSpawner. Confidence-driven agent creation wired into the workflow round loop.
  • CLIfelix init (scaffold projects), felix run (YAML config), felix version. Console script entry point.
  • 10 Examples — covering all SDK features from hello world to dynamic spawning.

Stats

Metric v0.1.0 v0.2.0
Tests 659 823
Public exports 26 34
Examples 5 10
Modules 7 10 (+ events, streaming, spawning filled, cli, utils)

PRs included

Test plan

  • 823 tests passing (pytest)
  • ruff clean
  • All 10 examples run with mock provider
  • felix version outputs 0.2.0
  • felix init scaffolds valid project
  • No breaking changes to v0.1.0 API

jkbennitt and others added 21 commits March 21, 2026 00:18
EventBus with exact/prefix/catch-all subscriptions, FelixEvent frozen
dataclass, EventType enum (agent.*, workflow.*, task.*, message.*,
stream.*, spawn.*), and EventEmitterMixin.

Wired into FelixWorkflow (6 lifecycle events), LLMAgent (task
start/complete), and CentralPost (lifecycle bridge). All event bus
params are optional — zero overhead when not used.

35 new tests. 698 total passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- EventEmitterMixin now writes _event_bus to instance dict explicitly
  via __dict__ to prevent class-level attribute leakage between instances
- Always call set_event_bus() in FelixWorkflow/LLMAgent __init__ (even
  when None) so the attribute exists for direct access in runner.py
- Added TODO comments on placeholder EventType members not yet emitted

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat(events): add event system for SDK observability
- configure_logging() one-call setup for all felix_agent_sdk.* loggers
- FelixLogConfig: level, format (text/json), per-subsystem overrides
- JSONFormatter: structured JSON output with event metadata fields
- EventLogBridge: subscribes to EventBus, auto-logs events at
  configurable levels (workflow events at INFO, task/agent at DEBUG)
- FelixEvent.__post_init__ normalises EventType enum members to plain
  strings for consistent str()/logging across Python versions

16 new tests. 714 total passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
EventBus.enable_history() now accepts max_size (default 10,000).
Oldest events are discarded when the limit is reached during emit().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat(logging): add structured logging and EventLogBridge
- StreamEvent/StreamEventType frozen dataclasses for token-level events
- StreamHandler base class with dispatch routing (token/chunk/result/error)
- CallbackStreamHandler for simple callable-based consumers
- EventBusStreamHandler re-emits stream events onto the event bus
- StreamAccumulator bridges provider StreamChunk to SDK StreamEvent,
  produces CompletionResult for parity with non-streaming path
- LLMAgent.process_task_streaming(task, handler) — full streaming
  processing with same lifecycle as process_task()

23 new tests. 737 total passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat(streaming): add streaming types, handlers, and accumulator
- ConfidenceMonitor: tracks per-agent/team confidence trends, detects
  stagnation, recommends SPAWN/HOLD/PRUNE
- ContentAnalyzer: keyword-based topic coverage gap analysis, recommends
  agent type to fill gaps
- TeamSizeOptimizer: heuristic team size from task complexity signals
- DynamicSpawner: orchestrates monitor + analyzer, creates agents via
  factory, connects via spoke manager, emits spawn events
- WorkflowConfig: enable_dynamic_spawning and max_dynamic_agents fields
- FelixWorkflow: _check_dynamic_spawning replaced with inline spawner
  integration, new agents join subsequent rounds

35 new tests. 772 total passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Eliminates triple duplication of stopword sets across
compression.py, task_memory.py, and content_analyzer.py.
Single frozenset in utils/text.py, aliased locally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat(spawning): add dynamic confidence-driven agent spawning
- felix init <name> [--template] — scaffolds project with felix.yaml,
  main.py, requirements.txt, .env.example. Templates: research, analysis, review.
- felix run <config.yaml> [--provider] [--verbose] — loads YAML config,
  resolves provider, runs workflow, prints result.
- felix version — prints SDK version.
- yaml_loader: parses helix presets or custom dicts, team composition,
  all WorkflowConfig scalars including dynamic spawning fields.
- Console script entry point in pyproject.toml.

20 new tests including init/run round-trip. 792 total passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat(cli): add felix console command with init, run, version
Extract and generalize the demo helix visualizer from
examples/05_deep_research_live/ into a proper SDK module at
src/felix_agent_sdk/visualization/. The new module provides:

- terminal.py: ANSI color primitives, cursor control, progress bars
- helix_visualizer.py: HelixVisualizer class with agent registration,
  live update, sidebar panel, phase boundaries, and team confidence
- AgentDisplayState dataclass for per-agent rendering state
- Exported via top-level __init__.py as HelixVisualizer

Includes 23 unit tests covering registration, update, rendering,
NO_COLOR support, context manager, and dimension customization.
All 686 tests pass, ruff clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Addresses review feedback from @CalebisGross:
- Remove unused `import os` in test file (ruff F401)
- Apply `ruff format` to helix_visualizer.py and test file

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the colour-name → ANSI-code mapping from helix_visualizer.py
into terminal.py as COLOR_MAP, eliminating duplicated constants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wire the HelixVisualizer into all four features that landed on dev/phase-2:

- Event bus: attach_event_bus() auto-registers agents on AGENT_SPAWNED,
  updates progress on AGENT_POSITION_UPDATED, marks DONE/FAILED
- Streaming: VisualizerStreamHandler shows live token count in sidebar
- Spawning: set_monitor() displays confidence trend and spawn
  recommendation in the footer
- CLI: felix run --visualize / -V flag for live helix during workflows

31 visualizer tests pass (23 existing + 8 new). 823 total tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: add reusable terminal helix visualizer module
- New examples: event_system, streaming, dynamic_spawning,
  structured_logging, yaml_workflow
- Fix yaml_loader _parse_team .pop() mutation (use .get() + filter)
- CHANGELOG.md: full v0.2.0 section covering all Phase 2 features
- README: update roadmap to reflect Phase 2 completion
- Version bump: 0.1.0 -> 0.2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 06: extract lambdas to named functions for readability
- 08: show gap-to-threshold instead of premature agent_id in
  SPAWN_TRIGGERED handler
- 09: use INFO level for JSON demo (less noise than DEBUG)
- 10: clarify API key requirement in README

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: examples v2, version bump to 0.2.0, changelog
@jkbennitt jkbennitt requested a review from CalebisGross as a code owner March 21, 2026 06:08
@jkbennitt jkbennitt merged commit 083f951 into main Mar 21, 2026
4 checks passed
@jkbennitt
Copy link
Copy Markdown
Member Author

@CalebisGross — v0.2.0 is out.

This one adds all the developer experience tooling on top of your core algorithms: event observability, structured logging, token-level streaming, confidence-driven dynamic spawning, and a CLI (felix init, felix run). 823 tests, 34 public exports, 10 examples.

Your helix geometry, hub-spoke routing, and agent lifecycle are still the foundation everything builds on. The dynamic spawning module in particular — ConfidenceMonitor, ContentAnalyzer, DynamicSpawner — is a direct formalization of the patterns you designed in the original Felix. It's the feature that makes this framework genuinely different from everything else out there.

If you want to check it out: pip install felix-agent-sdk==0.2.0 && felix version

Release: https://github.com/AppSprout-dev/felix-agent-sdk/releases/tag/v0.2.0

@jkbennitt jkbennitt deleted the dev/phase-2 branch March 25, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant