Skip to content

Conversation

@AndreRatzenberger
Copy link
Member

@AndreRatzenberger AndreRatzenberger commented Dec 1, 2025

Summary

This PR includes several significant improvements:

🐛 Bug Fixes

  • fix(core): propagate no_output to custom engines and utilities - When using .with_engines() or .with_utilities(), the orchestrator's no_output flag was not propagated
  • fix(core): propagate model from orchestrator to custom engines - When using DSPyEngine(adapter=...) without a model, it now inherits from Flock(model=...) instead of falling back to DEFAULT_MODEL env var
  • fix(engines): add timeout to streaming thread joins - Prevents hanging in Transformers provider

✨ New Features

  • feat(engines): Hugging Face Transformers local model support - Run Flock agents entirely locally with Flock("transformers/model-name")
  • feat(flock): no_output flag - Suppress terminal output when running as a service: Flock(no_output=True)
  • feat(api): Top-level imports - Common classes now available from root namespace:
    from flock import (
        DSPyEngine, BAMLAdapter, JSONAdapter,
        AgentComponent, EngineComponent, ServerComponent,
        Context, EvalInputs, EvalResult,
        Until, When, BatchSpec, JoinSpec,
        get_logger, configure_logging,
    )

📚 Documentation

  • New guide: Top-Level Imports (docs/guides/imports.md)
  • New guide: Local Models with Transformers (docs/guides/local-models.md)
  • New guide: Silent Mode (docs/guides/silent-mode.md)
  • Fixed mkdocs.yml navigation - many guides existed but weren't in the nav
  • Added missing server-components-concepts.md

Test Plan

  • All 2147 tests pass
  • New tests for no_output propagation (17 tests)
  • New tests for model propagation to custom engines
  • New tests for Transformers provider (26 tests)

Note

Exposes a rich top-level API, adds Hugging Face Transformers local model support, propagates silent no_output and orchestrator model to custom engines/utilities, and updates docs/navigation.

  • Core/API
    • Expose top-level imports in src/flock/__init__.py (engines, components, runtime types, visibility, conditions, subscriptions, logging) with optional Transformers provider auto-registration.
    • Add no_output to AgentComponent; propagate no_output to engines/utilities in Agent._resolve_engines/_resolve_utilities.
    • Propagate orchestrator model to custom engines lacking a model in _resolve_engines.
  • Engines
    • Default DSPyEngine construction carries no_output and model from orchestrator.
  • Docs
    • New guides: guides/imports.md, guides/local-models.md, guides/silent-mode.md; add getting-started/server-components-concepts.md.
    • Rework guides/index.md and mkdocs.yml navigation (new sections: Core, Components, Engines, Subscriptions, Publishing, Advanced, Operations; add tutorials/examples links).
  • Tests
    • Add tests for no_output propagation and model inheritance for custom engines/utilities.
  • Version
    • Bump package version to 0.5.318.

Written by Cursor Bugbot for commit d95319c. This will update automatically on new commits. Configure here.

When users provide custom engines via .with_engines() or custom utilities
via .with_utilities(), the orchestrator's no_output flag was not being
propagated to them, causing terminal output despite no_output=True.

Changes:
- Add no_output field to AgentComponent base class (inherited by all)
- Propagate no_output to user-provided engines in _resolve_engines()
- Propagate no_output to user-provided utilities in _resolve_utilities()
- Update tests to expect correct propagation behavior
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.64%. Comparing base (a4e1853) to head (d95319c).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
+ Coverage   83.60%   83.64%   +0.03%     
==========================================
  Files         144      144              
  Lines        9225     9245      +20     
  Branches     1170     1174       +4     
==========================================
+ Hits         7713     7733      +20     
  Misses       1212     1212              
  Partials      300      300              
Flag Coverage Δ
backend 83.64% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 25

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Add convenient top-level imports for frequently used classes:
- Engines: DSPyEngine, BAMLAdapter, JSONAdapter, XMLAdapter, ChatAdapter, TwoStepAdapter
- Components: AgentComponent, EngineComponent, OrchestratorComponent
- Runtime: Context, EvalInputs, EvalResult
- Artifacts: Artifact
- Visibility: PublicVisibility, PrivateVisibility, Visibility, etc.
- Conditions: Until
- Subscriptions: BatchSpec, JoinSpec, ScheduleSpec
- Store: FilterConfig

Users can now do:
  from flock import Flock, DSPyEngine, BAMLAdapter, AgentComponent
if self.engines:
# Propagate no_output to user-provided engines
for engine in self.engines:
engine.no_output = self.no_output
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Shared engine mutation causes race conditions

Mutating no_output on user-provided engines and utilities creates race conditions when the same instance is shared across multiple agents with different no_output settings. The documentation explicitly supports reusing engines across agents, but concurrent execution will cause unpredictable behavior as agents overwrite each other's no_output values. This affects both _resolve_engines() and _resolve_utilities().

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is expected behavior, not a bug. The orchestrator's no_output setting should take precedence - that's the whole point of propagation. If users want different settings per agent, they should use different engine instances. Sharing the same engine instance across agents with conflicting settings is a user design error.

uv.lock Outdated
[[package]]
name = "flock-core"
version = "0.5.311"
version = "0.5.312"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Version mismatch between pyproject.toml and uv.lock

The version in uv.lock is 0.5.312 but pyproject.toml specifies 0.5.313. These files must stay synchronized - the lockfile should be regenerated to match the project version.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was on an intermediate commit. The version has been bumped multiple times since then (now at 0.5.318) and uv.lock is regenerated automatically on each uv sync. Not a real issue.

New documentation:
- guides/imports.md: Comprehensive guide for top-level imports (DSPyEngine,
  adapters, components, Context, etc.)
- guides/local-models.md: Guide for running Flock with Hugging Face Transformers
  models locally without API keys
- guides/silent-mode.md: Guide for the no_output flag when running as a service

Also fixes:
- mkdocs.yml: Reorganized nav to include ALL existing guides that were missing:
  - DSPy Engine Deep Dive
  - Timer Scheduling
  - Webhook Notifications
  - Workflow Control
  - MCP Roots
  - Scheduled Agents tutorial
  - Connect with Ollama tutorial
- Created missing getting-started/server-components-concepts.md
- Updated guides/index.md with new cards for engines and imports

This should fix the "half of docs are missing" issue - guides existed but
weren't in the navigation.
Added missing exports:
- When: DSL for subscription activation conditions
- ServerComponent: Base class for custom HTTP server components
- ServerComponentConfig: Configuration for server components

Also improved docs/guides/imports.md:
- Every import now has a "Learn More" column linking to relevant docs
- Added navigation buttons to jump to detailed guides
- Added When to workflow control section with example
Added logging utilities to top-level namespace:
- get_logger: Get a Flock logger instance for your module
- configure_logging: Configure logging level and formatting

Now you can do:
  from flock import get_logger, configure_logging
  logger = get_logger(__name__)
When using .with_engines(DSPyEngine(adapter=...)) without specifying a
model, the engine would fall back to DEFAULT_MODEL env var instead of
inheriting the model from the Flock constructor.

Now custom engines without an explicit model will inherit the
orchestrator's model:

    flock = Flock("transformers/my-model")
    agent = flock.agent("x").with_engines(DSPyEngine(adapter=JSONAdapter()))
    # Engine now uses "transformers/my-model" instead of DEFAULT_MODEL

Engines with explicit models are unchanged - they keep their specified model.
@AndreRatzenberger AndreRatzenberger changed the title fix(core): propagate no_output to custom engines and utilities feat: major API improvements, local Transformers support, and bug fixes Dec 1, 2025
AndreRatzenberger and others added 2 commits December 1, 2025 11:30
Fixed inconsistency where the default utility component only had
config.no_output set but not the component's own no_output field.

Now both fields are set for consistency with how custom utilities
are handled.

Fixes Bugbot review comment on PR #370.
@AndreRatzenberger AndreRatzenberger merged commit 135ddba into main Dec 4, 2025
11 checks passed
@AndreRatzenberger AndreRatzenberger deleted the feat/output-bug-fix branch December 4, 2025 09:06
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.

2 participants