Changelog¶
[Unreleased]¶
🎉 New Features¶
- A run's traces group into one session or thread (0.5.804, #681) - Every span that knows its run's correlation ID carries it also as
session.idandgen_ai.conversation.id, the attributes Langfuse groups sessions by and Opik threads.Flock.publishtakes the run from the artifact it returns, since it creates the correlation (its span had none), and model-call spans (LM.chat, #680) carry their agent run's correlation, so a session adds up the run's tokens. In a two-agent run, Langfuse grouped the publish trace with both generations into one session, and Opik made it one thread.Flock.run_until_idlecovers every run and carries none. See auto-tracing. - A span per model call, in the OpenTelemetry GenAI conventions (0.5.803, #680) - Every model call of the DSPy engine gets an
LM.chatspan under the engine's span (named after Flock'sService.operationscheme, which the trace viewer splits at the first dot; the conventions'chat {model}would split inside model names such asgpt-4.1), withgen_ai.operation.name,gen_ai.provider.name,gen_ai.request.model,gen_ai.response.model, the call'sgen_ai.usage.input_tokensandgen_ai.usage.output_tokens(streamed calls included), the request parameters, the response ID and finish reasons, and the Flock agent asgen_ai.agent.name. Observability tools read these attributes; Flock's run totals (flock.usage.*, #571) are in a namespace of their own, so until now a two-agent run showed 29 spans and no model call in Langfuse and Opik. With this release the same run shows two generations with model and tokens in Langfuse, and two LLM spans with model, tokens and estimated cost in Opik. Message content is recorded only withOTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true, in the conventions' message schema and withinFLOCK_TRACE_MAX_ATTRIBUTE_BYTES; Responses API usage (input_tokens,output_tokens) is read as well as Chat Completions usage;FLOCK_TRACE_IGNORE='["LM.chat"]'leaves the spans out. A DSPy callback (flock.logging.genai_spans.GenAISpans) creates the spans, next to the callbacks already set in DSPy, and only while auto-tracing is on. See auto-tracing. - A REST publish can name its run (0.5.801, #618) -
POST /api/v1/artifactstakes an optionalcorrelation_id(1 to 256 letters, digits or._:-, so the status route finds it), andPOST /api/v1/artifacts/uploadthe same as a form field: artifacts published with one ID are one run, as forflock.publish(..., correlation_id=), so an app can publish every step of a game or every stroke of a drawing into one run. Without it, each publish starts a run of its own, as before. With a webhook, a named run's deliveries are numbered across its requests. In both HTTP services. - Smaller spans: a cap per input and output, short artifacts (0.5.791, #601) - A span keeps each input and its output as JSON up to
FLOCK_TRACE_MAX_ATTRIBUTE_BYTES(4096 by default, 0 for no cap), marker and escaping included; a longer value becomes{"truncated": true, "bytes": ..., "preview": ...}with as much of its start as fits, never splitting a character. Artifacts in inputs and outputs are kept as their type, ID, producer and payload, without visibility, tags and timestamps. With the triage demo and the dashboard open atFLOCK_TRACE_LEVEL=all, 30 seconds of spans went from 7.4 to 6.3 MB of attributes and the largest span from 48 to 10 KB; atagentsthe average span went from 5.8 to 4.7 KB. The tracing guide's attribute table namesinput.*,output.value,output.typeandoutput.length(it saidresult.*). - Trace levels: agent work by default, Flock's internals on request (0.5.790, #601) -
FLOCK_TRACE_LEVEL=agents(the default) traces workflow roots,Agent.execute, engines, the agent's own utility components, decision requests, tool and MCP calls, and errors.FLOCK_TRACE_LEVEL=allalso traces Flock's internals, as every release did until now: the dashboard serving itself (DashboardEventCollector,GraphAssembler, FastAPI's spans of the server's requests), the built-in orchestrator components (circuit breaker, deduplication, collection, activation, timer) and building and registering (Flock.agent,register_agent,serve, ...). With the triage demo and the dashboard open, 30 seconds wrote 208 spans atagentsand 1,551 atall. Classes mark themselves with__trace_level__ = "all", single methods with@trace_level("all")(flock.logging.auto_trace). See auto-tracing. - A decider's queue of decisions that need a review (0.5.786, #610, prerequisite of #566) - A decider's node in the dashboard's graph snapshot carries
decision.needsReview: its unsure decisions in view that no review answered (also a review outside the view), newest first, at most 20, each withid,question,correlationId,bestGuess,probabilities, theoptionsto review with andsubjectTitle(a field that names the decided artifact, else its first text);decision.needsReviewCountcounts all of them. Checklists are left out, since their unsure items are results, not a route to a person. The dashboard rework's decider Overview shows the queue with review buttons. - Active runs for a dashboard that connects while runs go on (0.5.785, #608, prerequisite of #565) -
GET /api/runs/activelists the runs going on now (run_id,agent_name,correlation_id,consumed_artifacts,start_time) from the dashboard's event collector; a dashboard learns of a run otherwise only from its start event, so one opened or reconnected meanwhile did not know it. Empty without the dashboard. See TracingComponent. - Artifact by ID with its consumption history (0.5.784, #605, prerequisite of #565) -
GET /api/v1/artifacts/{artifact_id}?embed_meta=trueadds the artifact'sconsumptions(consumer, run, correlation and time of each) andconsumed_by, as the list endpoint does withembed_meta. Stores getconsumptions_of(artifact_id): the in-memory, SQLite and Dapr stores read it by ID, and other stores fall back to searching the artifact's run. Visibility is enforced as before. The dashboard rework's Blackboard view loads an unfolded artifact card this way. See the REST API guide. - Trace endpoint for an agent's latest runs (0.5.783, #597, prerequisite of #561) -
GET /api/traces/agents/{agent_name}?runs=5returns the agent's latestAgent.executespans (1 to 50, by theiragent.nameattribute) and every span below them, in the format of/api/traces, read with a recursive query instead of the whole trace database. The Traces tab of the dashboard's unfolded node reads it. See TracingComponent. - Agent nodes carry their description and model (0.5.782, #592, prerequisite of #561) - Agent nodes in the graph snapshot carry
descriptionandmodel, for the header of the dashboard's unfolded node.modelis the model the agent's engine runs on, as it is resolved at run time: the flock's model (orDEFAULT_MODEL) for an agent without engines, also one registered withregister_agent(), and the flock's model for an engine whosemodelis unset;nullfor an engine without one, and for agents known only from their saved snapshot, which keeps no engines; deciders name their decision model in their decider info. - Agent nodes carry their subscription groups and last error (0.5.781, #585, prerequisite of #560) - Agent nodes in the graph snapshot carry
subscriptionGroups(each subscription's types, so the dashboard can label an AND gate or a join) and, while the agent's status iserror,lastErrorwith the type, message, time, correlation ID and run of its latest failed run. The run registry keeps the error type, andGET /api/agents/{name}/runsreports it aserror_type. The dashboard (0.1.35) takes the agent status from the run events. - Engine tag for the dashboard's agent cards (0.5.780, #583, prerequisite of #560) -
EngineComponent.kindis an engine's short label for the dashboard:DSPyEngineis"LLM",OpenClawEngineis"OpenClaw", and a custom engine setskind = "..."(none means no tag). Agent nodes in the graph snapshot carry it asengineTag, an agent without engines gets the default DSPy engine's, and a producer that is no agent (external) gets"source". The dashboard demo's scripted replies are tagged"LLM". See EngineComponent. - Artifact activity histogram (0.5.771, #572, prerequisite of #557) -
GET /api/v1/artifacts/histogramreturns the artifacts and workflow errors per time bucket for the filters of the artifact list (from/to, the last hour by default, and 1 to 500buckets), counting only what the caller may see. Stores getartifact_histogram(filters, buckets=): SQLite groups in SQL, over a new index oncreated_at, so a range reads only its own rows; the in-memory and Dapr stores count in Python. The dashboard rework's timeline dock draws it. - Token usage and cost per run (0.5.770, #571, prerequisite of #557) - Every agent run reports its
prompt_tokens,completion_tokens,tokens_used,usageper model andcost_usdin its metrics, which reach the dashboard's Run Status and the run's trace (flock.usage.tokens,flock.usage.cost_usd). The DSPy engine tracks the usage LiteLLM reports, also when streaming; decision agents count the input tokens of each request once, across escalation tiers, votes, sections and the shadow. Costs come from LiteLLM's price table, andFlock(model_prices={"azure/decision-1": (0.5, 0.0)})prices the models it does not know (USD per million tokens); a run with an unpriced model reports its tokens and no cost, and a failed run the requests it made. Custom engines report usage withflock.utils.usage.report_usage()or inEvalResult.metrics["usage"], which accepts nested values.GET /api/agents/{name}/runs, which returned an empty list until now, lists the agent's runs from the dashboard's event collector, newest first, so the dashboard's Run Status shows them (dashboard 0.1.34: an unpriced run shows no cost, an active run no duration yet); run durations use the monotonic clock. The dashboard demo reports tokens and costs at demo prices. See Token usage and cost. - Dashboard demo without API keys (#570) -
examples/04-misc/10_dashboard_triage_demo.pyruns the ticket triage of the dashboard design: decisions from aFakeDeciderthat takes a moment (some tickets stayUNSUREfor review), team replies streamed token by token by a scripted engine, an AND gate, a join, a batch, a timer and an agent that fails every third time.--portserves a second dashboard for A/B comparisons. - Kingfisher milestone: a new CLI banner and
flock-flow --about(0.5.760, #555) - The milestone after "Raven" is named for the decision models: the kingfisher sits still, watches the water and dives only when it is sure, as a decision model answers firmly above its threshold and staysUNSUREbelow it. The banner is a formation of birds shaped like a prompt (>) in front of a compact FLOCK wordmark, with the version and milestone, a tagline and the model; it replaces the emoji box, whose bottom border the version pushed out of line.flock-flow --aboutshows the kingfisher as a colored half-block sprite and what it stands for, andpython -m flockruns the CLI. The docs now call the CLI by its installed name,flock-flow(flockis util-linux's file-locking tool), e.g.flock-flow decisions calibrate DB. - Calibrating decision thresholds (0.5.757, #542, completes #474) -
calibrate(decisions, labels, target_precision=0.95, min_support=5)(flock.decisions.calibration) suggests per decider and question, and per checklist item, the lowest threshold whose firm answers reach the target precision, with its precision and coverage (labels per artifact and question);labels_from_reviews()makes human reviews labels, andflock-flow decisions calibrate DBprints the suggestions for a SQLite store..decides(..., item_thresholds={item: threshold})gives checklist items their own threshold ("Controls.mfa"when item names repeat), and the dashboard names how many a decider has.examples/15-decisions/14_calibration.pycalibrates on half of the compliance documents and measures on the other half: precision of "shown" 0.76 → 0.80, recall 0.99 → 0.90, almost three times as many unsure answers; 12 labelled documents per control are too few for the target. Escalating and voting deciders get no suggestion (a note says why); decisions record the decider'smode(single,escalation,ensemble) and the item thresholds that applied, and the CLI prints thresholds exactly. See Calibrating thresholds. Frontend 0.1.33. - Human review of decisions (0.5.756, #540, part of #474) -
await flock.review(decision_id, choice="tech", reviewer="lead")publishes a person's answer as a decision of the same question about the same subject (probability 1.0,modeland producer the reviewer,review_ofthe reviewed decision, the original's correlation and visibility), so it routes like any other decision; withoutchoice, the best guess is confirmed. Choice, yes/no and scale decisions can be reviewed.POST /api/control/decisions/{id}/reviewdoes the same over the control API, and the dashboard shows review buttons on unsure decisions and the review on reviewed ones.examples/15-decisions/13_human_review.pyroutes the reviewed tickets to the chosen teams. See Human review. Frontend 0.1.32. - Long documents in sections (0.5.755, #538, part of #474) -
.decides(Controls, sections=Sections(field="text", max_chars=4000))splits a text field at paragraph boundaries and asks every question about each section. A checklist item keeps the section with the most probable yes (yes if any section shows it), other questions the most confident section. Decisions recordsections: the field, the sections' spans andanswered_by, the section per answer. Works withescalate=andshadow=. The dashboard names a decision's sections and the answering section.examples/15-decisions/12_long_documents.pyshows where each control is shown, and that on manuals that fit, the whole is more precise (0.87 against 0.75 with 51 instead of 12 requests). See Long documents in sections. Frontend 0.1.31. - Coverage: checklist results across artifacts (0.5.754, #536, part of #474) -
.consumes(Controls.ANY).aggregates(by="organisation", combine="any")combines a checklist's decisions per group of decided artifacts and publishesCoverage.of(Controls)(flock.decisions.coverage) after every decision: combinedresultsper item, an outcome,evidence(the artifacts that showed each item),subject_ids,decision_idsand arevision(the highest per group is current, whatever order coverages were stored in).combine="any"counts an item once any artifact shows it,"all"only if every artifact does. Groups are also filled from the agent's context (with the default provider, all visible decisions, so a restart with a persistent store recovers them), updates run one at a time, and coverage keeps the group's visibility (orvisibility=). The dashboard counts an aggregating agent's groups by outcome and shows a coverage as a checklist grid.examples/15-decisions/11_coverage.py: per organisation, "shown" has recall 0.99 and precision 0.78 against the ground truth. See Coverage across artifacts. Frontend 0.1.30. - Explain decisions on demand (0.5.753, #534, part of #474) -
.consumes(Route.UNSURE).explains(model="openai/gpt-4.1")makes an agent that lets an LLM explain each decision it receives. The LLM gets the decided artifact and the decision (question, options and criteria, probabilities, threshold, checklist results) and writes anExplanation(flock.decisions.explain): why the decision came out this way, citing the input, and what would settle it. Flock links it to the decisions (decision_ids,questions) and subjects (subject_ids), records the LLM, and keeps the subjects' visibility (orvisibility=on.explains()). Decisions now record custominstructions, so the explanation describes the question that was actually asked. The dashboard shows explanations as text and an explained decision's explanation on its card.examples/15-decisions/10_explain.py: of eight tickets, Microsoft-Decision-1 was unsure about one at threshold 0.95, and the LLM ran once. See Explain on demand. Frontend 0.1.29. - Shadow mode for decision models (0.5.752, #532, part of #474) -
.decides(ResearchField, model="azure/decision-1", shadow="openai/gpt-6-luna")lets a candidate model answer every question too, concurrently. Its answer (choice under the same threshold, best guess, probabilities, latency; outcome and results for checklists) is recorded in the decision'sshadowand never routes, so a model switch can be evaluated on live traffic. A failing shadow records its error and never fails the decision; one slower thanshadow_timeout(default 10 s after the live answer) is cancelled and recorded as a timeout. The dashboard shows how often the shadow agrees on the decider and the shadow's answer on every decision.examples/15-decisions/09_shadow.py: with Microsoft-Decision-1 live,gpt-6-lunawould have routed 86 of 100 arXiv abstracts the same way. See Shadow mode. Frontend 0.1.28. - Ensembles and voting for decision models (0.5.751, #530, part of #474) -
.decides(ResearchField, models=["azure/decision-1", "jev/jev-latest", "openai/gpt-6-luna"], vote="majority", threshold=0.8)asks every model about every question, concurrently, and votes:majority(default) needs more than half of the models to give the same firm answer,unanimousall of them, andmeanapplies the threshold to the mean probabilities. A refusal is no vote; checklist items are voted one by one. Decisions record every model's answer invotes, and theirprobabilitiesare the mean over the models that answered; disagreement routes toUNSURE. The dashboard shows a decider's vote and models and a decision's votes.examples/15-decisions/08_voting.pycompares each model with the ensemble on 100 arXiv abstracts: the unanimous vote sorted 80 papers with 78 agreeing with arXiv,gpt-6-lunaalone 95 with 91. See Ensembles and voting. Frontend 0.1.27. - Escalation cascades for decision models (0.5.750, #528, part of #474) -
.decides(ResearchField, model="azure/decision-1", escalate=["openai/gpt-6-luna"], threshold=0.9)asks the next model about every question the previous one was not sure about (below the threshold or refused); only those questions, and of a checklist only the unsure items, go up. Decisions record thetierthat answered and the earlierattempts; still unsure after the last tier, a decision routes toUNSUREas before. Every tier must accept images when the inputs hold one, andescalate=cannot be combined withtournament=yet. The dashboard shows a decider's cascade and an escalated decision's trail.examples/15-decisions/07_escalation.pysorts 100 arXiv abstracts: Microsoft-Decision-1 answered 82,gpt-6-luna12 of the other 18, 6 went toUNSURE. See Escalation cascades. Frontend 0.1.26. - Image limits on every publish path, and an Images guide (0.5.743, #513, completes the scope agreed for #464) - every artifact's inline image data is checked against the limits of
Imagefields (20 MB, 50 million pixels) before it is stored, soArtifactobjects published directly, component publishes and models changed after creation cannot bypass them; models, dicts, REST JSON, uploads and the dashboard already enforced them. The new Images guide documents creating images, the limits, every publish path, agents and decision models, dashboard thumbnails and the security rules (no fetching, checked uploads, visibility, including the known WebSocket and graph gaps tracked in #431 and #432). Tests cover the limits on each path and that private image data and thumbnails stay private over the REST API. - Image thumbnails across the dashboard, full images on demand (0.5.742, #512, part of #464) - the message detail window, message history and historical blackboard show image thumbnails (field, type, size); clicking one loads the full image through
/api/v1/artifacts/{id}, which applies visibility.GET /api/v1/artifactsand/api/v1/artifacts/{id}acceptimages=thumbnails(description in the payload plus animageslist with 160 px previews; default stays full). WebSocketmessage_publishedevents and the message history carry descriptions and thumbnails instead of full image data. Frontend 0.1.25. - Publish images from the dashboard and the REST API (0.5.741, #511, part of #464) - the dashboard publish panel shows a picture picker with previews for
Imageandlist[Image]fields; pictures are scaled to 1024 px and re-encoded in the browser, and the server re-encodes dashboard images again (format, size and pixel checks, metadata dropped). Validation errors from the dashboard publish return 422 again instead of 500.POST /api/v1/artifacts/uploadtakesmultipart/form-datawith one file part perImagefield, named after the field or its alias (JPEG, PNG, GIF, WebP, BMP; at most 20 files per request, 20 MB and 50 million pixels per file, checked before parsing and decoding) and re-encodes each file likeImage.from_bytes(). The JSON endpoint keeps accepting data URLs.Imageschemas carry"x-flock-image": true, andpython-multipartis now a direct dependency. Frontend 0.1.24. - LLM agents see images (0.5.740, #510, part of #464) -
flock.Imagefields of consumed artifacts reach the model as pictures through the DSPy engine (dspy.Image), at any depth (Image | None,list[Image], tuples, nested and self-referencing models) and in batches and joins. Images in conversation context are described (🖼 image/jpeg · 42 KB) instead of inlined as base64. Pictures sent to an OpenAI API model that LiteLLM lists as text-only fail before any request with an error naming the image fields. Example:examples/01-getting-started/19_image_agent.py. - Rate limits for decision models - HTTP decision providers retry HTTP 429 and 503 up to 7 times. The wait is the provider's advice (
retry-after-ms,Retry-Afterorx-ratelimit-reset-requests; seconds on Azure, durations such as6m0son OpenAI) plus an exponential backoff with jitter, at most 60 s per wait, so that a burst of rejected requests does not come back at once.Flock(decision_rate_limit="100/min")adds a request budget per decision model: all deciders that use the same model share it, and requests over the budget wait for a free slot instead of failing. See Rate limits. - Decision networks - several handles in one
.consumes()mean AND about the same subject:.consumes(Route.billing, Urgent.yes)or.consumes(*(screen.ANY for screen in screens))runs once a matching decision for every handle has arrived about the same subject (a join onsubject_ids), delivers the subject once and puts all decisions intoctx.decisions..decides(question, options=callable)restricts a Choice or Checklist to options chosen at runtime and records them ascandidates. Together they build screening networks: parallel screen nodes over slices of a catalog and a ranker over their passes.examples/15-decisions/06_control_mapping_tournament.pycompares a single choice, a tournament and a screening network on the same sentences (10/10 each; 182 ms, 388 ms, 441 ms). See Decision networks. - Tournament bracket view - every tournament round records its group size and, per group, the top candidates with probabilities (survivors plus the two strongest eliminated options). ⤢ bracket on a tournament decision opens a full-screen bracket: one column per round, lines from every survivor to the next round, the winner's path highlighted and any option traceable on hover.
- Tournaments for large choices -
.decides(Requirement, tournament=Tournament(group_size=20, keep=3))asks a Choice in rounds: groups of options as separate choice questions in one request, the most probable options of each group survive, then a final question. Choices may now define more than 255 options; they must be asked as a tournament. Decisions record theirrounds(candidates, groups, refused groups, survivors). The dashboard shows the rounds above the final probabilities and compacts deciders and decisions with many options.examples/15-decisions/06_control_mapping_tournament.pymaps evidence sentences to one of 100 controls: 25/25 with a single choice at 180 ms and 25/25 with a tournament at 419 ms. See Decision Models. - Flock-wide decision model -
Flock("openai/gpt-4.1", decision_model="azure/decision-1")sets the decision model for every.decides()agent of the flock (a model string or aDecisionProvider).model=on.decides()still wins;DEFAULT_DECISION_MODELis the fallback. - Checklists for decision models -
Checklistasks the same yes/no question for every item of a catalog and publishes one decision per artifact, withresults(yes / no / UNSURE per item) and an outcome (failedif any item is no,UNSUREif any is unsure,passedotherwise).Checklist.from_items()andChoice.from_options()build question classes from data. Subscribers use.consumes(Controls.failed),.consumes(Controls.passed)or a single item,.consumes(Controls.bcm_06.no)..decides(..., questions_per_request=100)splits large question sets into concurrent requests. The dashboard shows checklist deciders with outcomes, a per-item strip and the most frequent gaps, and checklist decisions as a grid of item cells.examples/15-decisions/05_compliance_checklist.pychecks 24 generated documents against 100 controls: recall 0.99 (an unsure answer counts as missed) and precision 0.75 against ground truth on Microsoft-Decision-1, about 600 ms per document. See Decision Models. - Yes/no and scale questions for decision models, several per request -
YesNo(systemonenoul, OpenAIpredicate) andScale(2-10 ordered levels, systemone and OpenAIscore) joinChoice..decides(Route, Urgent, Anger)asks all questions in one request and publishes one decision per question; subscribers use.consumes(Urgent.yes),.consumes(Anger.angry)or, on the probability-weighted score,.consumes(Anger.angry.or_higher)/.or_lower. Decisions carrykind,scoreandrefused: a question the model refuses lands inUNSUREwithrefused=Trueinstead of failing. The dashboard draws each question by kind (option bars, a yes/no split bar with the unsure zone, ordered level histograms with the weighted score). Verified live on Microsoft-Decision-1, OpenAIgpt-6-luna, TypeSafe Jev and a local Clef model. See Decision Models andexamples/15-decisions/04_question_types.py. - Images in artifacts and decisions (
flock.Image) - an image field holds the picture as a base64 data URL;Image.from_file()/from_bytes()/from_pil()downscale (default 1024 px) and strip EXIF. Decision models that accept images (openai/, vision-enabledlocal/servers) receive everyImageof a decider's inputs; text-only providers refuse them with a clear error. The dashboard shows image thumbnails, lanes of the latest images per decision option, and the decided image next to its probabilities. Pillow is now a base dependency. See Decision Models andexamples/15-decisions/03_color_sorter.py. -
Decision models - an agent answers a typed
Choicequestion with a decision model (calibrated probabilities over a closed option set, no generated text) and publishes aDecision; other agents subscribe to an option and receive the artifact that was decided on:class Route(Choice): """Which team should handle this support ticket?""" billing = "Charges, invoices, refunds" tech = "Bugs, crashes, login problems" flock.agent("triage").consumes(Ticket).decides(Route, model="azure/decision-1", threshold=0.8) flock.agent("billing").consumes(Route.billing).publishes(Reply) flock.agent("supervisor").consumes(Route.UNSURE).publishes(Reply)Providers: Microsoft-Decision-1 on Azure AI Foundry (
azure/), OpenAI Decisions (openai/), TypeSafe Jev (jev/) and any local/v1/systemoneserver such as llama.cpp with a Clef model (local/). Decisions inherit their subject's visibility. The dashboard shows decision agents with their options and counts, labels edges by option and renders decision artifacts as probability bars. Inexamples/15-decisions/02_arxiv_race.py, Microsoft-Decision-1 sorts 100 arXiv abstracts into research fields at 169 ms per paper against 598 ms forgpt-4.1, agreeing with arXiv's category on 90 papers against 85. See Decision Models.
⚠️ Changes¶
-
PyTorch is no longer a dependency. Semantic subscriptions (
flock-core[semantic]) compute the sameall-MiniLM-L6-v2embeddings with fastembed on ONNX Runtime instead ofsentence-transformers. Similarity scores are identical (450 query/text pairs: largest difference below 0.00001, no decision changed at thresholds 0.3-0.7), sosemantic_matchthresholds keep their meaning. The model (~90 MB) is downloaded on first use to~/.cache/flock/fastembed(override withFASTEMBED_CACHE_PATH).Fresh install from uv.lock, including downloadsBefore Now flock-core[semantic]: environment size7.48 GB (140 packages) 404 MB (117 packages) flock-core[semantic]: install time302 s 10 s The semanticextra on its own+7.16 GB, +295 s +86 MB, +2.5 s Full development environment (all extras and groups) 8.03 GB, 310 s 702 MB, 16 s Measured in a fresh
ghcr.io/astral-sh/uv:python3.12-bookwormcontainer per run (uv 0.9.30, empty cache, same machine and network, one run each). A base install without extras is unchanged (~316 MB, 8 s). -
Removed: the in-process Hugging Face provider (
Flock("transformers/<model>"), extraflock-core[transformers]). Run local models in an OpenAI-compatible server (Ollama, llama.cpp, vLLM, LM Studio) and use its model string, e.g.ollama_chat/qwen3:4b. See Local Models. - Starlette 1.3 with FastAPI 0.143, MCP Python SDK 1.28.
requirements.txtwas removed; dependencies are managed with uv (pyproject.toml,uv.lock).
🐛 Fixes¶
- Tracing guides: a guide for observability backends, comparisons without claims about other tools (#682). Tracing backends has the settings for Langfuse, Opik, Arize Phoenix, Jaeger and MLflow, each checked with a two-agent run against a local instance, and what each shows of a Flock run. The comparison sections in "Using Tracing Effectively" and "Production Tracing" listed other tools under "❌" with claims nobody had checked, and said cost tracking was missing although #571 added it; they now describe local tracing and export side by side. The README's Observability section names the export, the model-call spans, sessions and threads, and the run totals.
- Trace viewer: long attribute keys no longer run into their values (frontend 0.1.37, #680). The span details showed their keys in a 120 px column, and a longer key, such as
flock.usage.cost_usd(#571) or thegen_ai.*keys of model calls, ran into its value. The key column now fits the longest key, up to 40 % of the width, and wraps a key only beyond that. - Auto-tracing exports OTLP over HTTP too (#679). The OTLP exporter was always gRPC: auto-tracing read only
OTEL_EXPORTER_OTLP_ENDPOINT, andOTEL_EXPORTER_OTLP_PROTOCOL, which the tracing guides already documented, was ignored. Tools that take OTLP over HTTP only (Langfuse, Opik, MLflow) could not receive Flock's traces. Auto-tracing now follows the OpenTelemetry variables:OTEL_EXPORTER_OTLP_TRACES_PROTOCOLorOTEL_EXPORTER_OTLP_PROTOCOLchoosesgrpc(still the default) orhttp/protobuf,OTEL_EXPORTER_OTLP_TRACES_ENDPOINTis used as given and also switches export on, over HTTP the base endpoint gets/v1/traces, and headers come fromOTEL_EXPORTER_OTLP_HEADERS. An empty endpoint variable now counts as unset, as the spec says. Tested by sending a two-agent run to Langfuse v4 and Opik with these variables alone. See auto-tracing. - Jupyter development tools no longer leak Referer tokens in server error logs (GHSA-c3mw-737p-c7g2). The lockfile updates
jupyter-serverfrom 2.20.0 to 2.21.0, which redacts tokens in the Referer header when logging server errors. Jupyter is a development dependency; Flock's FastAPI dashboard and API do not use this server. Existing development environments needuv sync --locked --dev(with their usual extra flags) and a restart of any running Jupyter server. - Tracing no longer slows a flock down or bloats the trace file (#601). The DuckDB, OTLP, file and SQLite exporters ran behind OpenTelemetry's
SimpleSpanProcessor: every span that ended was written at once, mostly on the event loop, and the DuckDB exporter opened the file and inserted one row with its own commit per span. WithFLOCK_TRACE_FILE=truethe triage demo ran 3 agent runs in 30 s, and the file grew to about 100 times its data. The exporters now run behind aBatchSpanProcessor(a batch at least every second;OTEL_BSP_*variables andTelemetryConfig(batch_processor_options=...)tune it), the DuckDB exporter writes a batch in one transaction with 128 rows per statement (20,000 spans of 6 KB: 174 s before, 23 s now), andFlock.shutdown()writes the spans still waiting (at most five seconds, also when OpenTelemetry's flush blocks on a slow exporter);Flock.clear_traces()and the dashboard's clear write them before deleting, so they do not come back. Trace files lose the indexes onservice,start_time,nameandcreated_at, which sped up no query of the dashboard;trace_idkeeps its index. See auto-tracing. - Dashboard trace reads and span exports no longer fail when they meet (#599). The tracer's DuckDB exporter and the dashboard's trace endpoints use the same file in the same process, the exporter with DuckDB's default configuration and the endpoints read-only. DuckDB refuses a second connection to a file in one process with another configuration, so span batches were lost and trace requests answered
[]whenever the two met (308 lost batches in a few minutes of the dashboard demo). The endpoints now connect like the exporter and share its database. - The dashboard shows the traces the tracer writes (#594). With
FLOCK_TRACE_FILE=truethe tracer writes.flock/traces.duckdbin the working directory, whichFlock.clear_traces()also clears, but the dashboard's trace endpoints read.flock/traces.duckdbnext to the installed package (src/.flock/in a source checkout), so the trace viewer showed no traces of the running flock. They now read the working directory's file, and they look for it on every request: a flock that starts before its first span is traced no longer answers[]until a restart. - A batch's waiting state reports its timeout on any host (#590).
BatchEnginestarted batches with a naive localcreated_at, and the waiting state read it as UTC, so a host two hours ahead of UTC reported a fresh 60 s batch withelapsed_seconds-7200 andtimeout_remaining_seconds7260 (in/api/agents, the graph snapshot andbatch_item_addedevents). The elapsed time is now measured on the monotonic clock the timeout uses (BatchAccumulator.elapsed_seconds()), andcreated_atis UTC. The batch itself always flushed on time. - A failed agent stays failed in the dashboard (#585). The event collector set an agent back to
idleand broadcastagent_completedwhen a failed run ended, so the dashboard showed the failure only for a moment. The collector now derives an agent's status from its runs (running while any runs, otherwise by the run it started last, so concurrent runs ending out of order do not overwrite each other),agent_completedandagent_errorcarry it asagent_status, and the dashboard takes it from there; a failed run broadcasts onlyagent_error. - The live output tests no longer time the machine (#587). Three "virtualization" tests asserted wall-clock limits (under 100 ms and 50 ms) and failed at random on slow CI runners. They tested a mock defined in the test file, not the Live Output tab, which does not virtualize, so they are removed; the rework's Live tab (#561) replaces the component.
- Dashboard keyboard shortcuts work again (#581).
AppandDashboardLayoutboth registered the shortcuts, so Ctrl+M, Ctrl+Shift+P, Ctrl+Shift+F and Ctrl+, toggled twice and did nothing, and Esc closed two panels per press. The layout registers them once. - The publish panel's tests wait for the artifact types (#578). The panel renders its type select before the types load, and the tests chose a type as soon as the select was there, so they failed at random on slow CI runners (12 of 15 with the types arriving 20 ms later). They now wait for the type's option.
- Dashboard decisions show their review and explanation, wherever these are (#550). A decision in the graph showed its review and explanation only when they were in the same view, and an aggregating agent counted each group by the newest coverage revision in view. Reviews, explanations and newer revisions are published later, so filters and the view's limit left them out: a reviewed decision offered its review buttons again, and a group could count with a stale outcome. The graph now loads them from the store, starting at the earliest decision or coverage in view, with the view's visibility filter.
- The dashboard graph shows the newest artifacts when more than its limit match (#554). The graph read the first page of its store query, ordered oldest first, so with more than 500 matching artifacts (the default limit) a live dashboard showed the oldest ones and new artifacts appeared only once older ones left the time window. A full view now shows the newest artifacts;
total_artifactsandtruncatedare unchanged. - Decision examples count unsure answers as misses (#552).
05_compliance_checklist.py,11_coverage.pyand12_long_documents.pycomputed recall over firm answers only, so an unsure answer about a shown control was not counted as missed. With the fix, Microsoft-Decision-1 reaches recall 0.99 instead of 1.00 in 05 and 11, and 0.96 (whole manual) and 0.99 (sections) instead of 0.98 and 1.00 in 12; the README, the decisions guide and the examples README quote the new numbers. - LLM agents see every input of one type (#546). An agent consuming several artifacts of one type at once, such as
.consumes(Task, Task), received all of them, but the DSPy engine sent only the first to the model. Such inputs are now one list field (tasks: list[Task]), as in batches; types that occur once keep their singular field. A fan-out of the input type (.publishes(Task, fan_out=2)) is namedoutput_tasksinstead of replacing the input list; this also fixed batches with such a fan-out. - The newest artifacts show in "last N minutes" views (#547). The dashboard graph and the historical blackboard filtered the time presets up to the clock reading of the request, so an artifact stamped later (a wall clock that stepped back, as WSL2 does every 30 s, a browser clock behind the server's, or a publish racing the request) was left out. The presets now bound the start only; custom ranges keep their end.
- Models with field aliases work everywhere (#544). Payloads are stored with
model_dump()(field names) but were rebuilt by alias, so publishing a model such asorder_id: str = Field(alias="orderId")raised as soon as an agent subscribed to it, and joins,get_by_type()(in-memory, SQLite, Dapr),EvalInputs.first_as()/all_as(),.calls(), outputwhere=/validate=/dynamic visibility,FlockApplicationinputs given by field name or as another model,FlockApplicationoutputs and LLM outputs of such types failed; the DSPy engine passed such inputs to the LLM as plain dicts. Payloads are now rebuilt withmodel_from_payload()(flock.core.artifacts), which accepts field names and aliases. JSON from REST clients is validated by alias as before. - Scripts using the SQLite store exit. The aiosqlite connection ran on a non-daemon thread, so a process whose
SQLiteBlackboardStorewas never closed hung afterasyncio.run()returned, andflock.shutdown()did not close the store. The connection thread no longer keeps the process alive, and a fullflock.shutdown()closes a SQLite store, which reconnects if used again. If an agent task outlivescancel_grace, the store stays open so the late task cannot reopen it; close it withawait store.close()once the task has ended. Other stores are not closed. - New models work through Azure and gateways too. When an API rejects
max_tokensand asks formax_completion_tokens(an Azure deployment ofgpt-6-luna, for example), the DSPy engine retries that request once withmax_completion_tokensand remembers the model and endpoint for the rest of the process. The retry happens per LM request, so the agent's program and streaming are not re-run; other errors are not retried. - Timers and batches conflict in either order.
.schedule()rejected an existing batch subscription, but.schedule().consumes(..., batch=...)was accepted. Both orders now raise the sameValueError. TimeWindowContextProviderworks. It compared a naive localdatetime.now()with the UTCcreated_atof artifacts, so every agent using it failed withTypeError: can't compare offset-naive and offset-aware datetimes. The window is now computed in UTC and filtered by the store (FilterConfig(start=...)) instead of loading every artifact.- SQLite store persists artifacts with datetime fields.
SQLiteBlackboardStorewrote payloads with plainjson.dumps, so any artifact with adatetime,date,UUIDorDecimalfield failed to publish, and scheduled agents never ran because every timer tick carries adatetime. Payloads are now encoded the way Pydantic does, as in the Dapr store; such values read back in their JSON form and validate into the model again. - Roadmap matches the backlog.
ROADMAP.mdand the docs roadmap still promised 1.0 for Q4 2025 and listed shipped features as in flight. Both now list what 0.5 offers and summarize the planned work for Q4 2026: the 1.0 release scope and the separately qualified integrations. - Scheduling docs and examples match the API. The scheduling guide, tutorial and example README described timer agents as functions with an
AgentContextandctx.get_artifacts(), which do not exist, and used.consumes()as a context filter. They now show LLM agents, custom engines and.with_context(...)for choosing what a timer run sees, and state that times are UTC. Examples 02-05 use context providers instead of.consumes(); the one-time reminder uses a UTC datetime (a naive local time fired off by the UTC offset), and the batch processor publishes one aggregate per sensor. - New OpenAI models work with the default DSPy engine. For the OpenAI API (
openai/without a custom base URL) the engine now sends its token limit asmax_completion_tokens;gpt-6-lunaand other new models rejectedmax_tokenswith HTTP 400. OpenAI-compatible servers behindopenai/keepmax_tokens. - Streaming agents report the real error. DSPy's
streamifywraps a failure in an anyio TaskGroup, so logs andWorkflowErroronly said "unhandled errors in a TaskGroup (1 sub-exception)". A single wrapped failure is now unwrapped (CLI and dashboard streaming), and the console ends with a red error panel instead of an empty placeholder result. - Batching performance test no longer fails on slow CI runners. It compared the time of 100 batched publishes with a fixed 3,000 ms limit, which branch coverage and slower runners exceeded; it now compares against the same publishes handled one by one in the same run.
- No more
Type mismatch for fieldwarnings from DSPy agents. The DSPy engine passed validated inputs as dicts while the signature types them as Pydantic models; DSPy 3.2 checks this and warned on every run. Inputs are now passed as the validated models; prompts are unchanged. - Test runs no longer crash agent output rendering. A CLI helper test removed
richfromsys.moduleswithout restoring it, so later tests ran with two copies of rich's classes. Rich's own type checks then failed (Text.append() takes from 2 to 3 positional arguments but 7 were given), output rendering crashed and agent runs were marked failed in every full run. The test now restores the original modules. - No dashboard build in the repository. The dashboard is built locally on the first
serve(dashboard=True); the unused committed build insrc/flock/api/static_files/and the stalescripts/build_dashboard.pywere removed. The context-provider guide's redaction example is now a working sketch instead of a link to a removed example. - Decision models, review fixes (found in code review of the decision model PRs before release):
- Providers reject answers with probabilities that are not finite or outside 0-1, instead of turning them into firm decisions; rounding just outside 0-1 is clamped. Scale scores must be finite and within the levels, since
.or_higherand.or_lowerroute on them; a refused question has no score and matches no level. - A decision agent publishes only its decisions:
.decides()with.with_engines()or.publishes()fails in either order. One agent cannot consume a question's handles and its decision type. - The dashboard keeps the other inputs of an agent that consumes a decision type directly, and only
UNSURE(orX.UNSURE) edges count as the unsure branch. - Checklist items take the more probable answer before the threshold (thresholds below 0.5 no longer turn a 0.45 into
yes). Option names from catalogs cannot shadow the question class (__kind__,from_items), and checklist item requests cannot collide with other question names. - Tournaments advance a leftover group of one option without a request.
options=works for catalogs over 255 options (more than 255 runtime candidates withouttournament=fail), and an empty runtime checklist is not marked refused. - Request budgets book a start when it happens (a late wake-up cannot let several requests through) and stay per flock when a provider instance is shared.
- Images over 20 MB (base64 padding not counted, only canonical base64 accepted) or 50 million pixels are rejected when the artifact is created; the dashboard compacts image data also when no thumbnail can be made.
- The bracket view is a modal that takes, keeps and returns keyboard focus; checklist cells carry their result as an accessible label.
- Providers reject answers with probabilities that are not finite or outside 0-1, instead of turning them into firm decisions; rounding just outside 0-1 is clamped. Scale scores must be finite and within the levels, since
- Batch timeouts no longer depend on the wall clock.
BatchSpec(timeout=...)measured the elapsed time withdatetime.now(). When the wall clock stepped back (VM time sync, NTP), batches flushed late andrun_until_idle()could return before the flush; when it stepped forward (daylight saving), they flushed early. Timeouts now run on the monotonic clock. The timer tests check the waits they ask for instead of elapsed wall time. Both fix intermittent failures of four timing tests.
🔒 Security¶
- Two Dependabot alerts on
mainclosed (#689). LiteLLM 1.100.4 fixes GHSA-7hp6-4w63-5g45, a privilege escalation in the LiteLLM proxy server, which Flock does not run; the pin moves with this dependency bump, as CONTRIBUTING.md asks for proxy-only advisories. dnspython 2.9.1 in the lockfile fixes GHSA-45c3-73f7-pv4m, excessive CPU use when parsing DNS messages (it comes in throughpydantic[email]). From 1.100 on, LiteLLM requires boto3, so boto3 and botocore are now installed with Flock. - 113 Dependabot alerts on
mainclosed (backend 0.5.802, frontend 0.1.36, #676). Pillow 13.0.0 fixes 41 advisories, six of them critical (among them a JPEG decoder buffer overflow reachable through dashboard image uploads);fastembedgoes to 0.9.1 for it, because 0.9.0 requirespillow<13. MCP SDK 1.30.0, and in the lockfile certifi 2026.10.23, aiohttp 3.14.5, filelock 4.2.4, OpenTelemetry 1.45.1, and for development GitPython 3.2.1, nbconvert 7.17.2 and virtualenv 21.14.13; vitest 4.1.12 for the frontend tests. Pillow 13's breaking changes do not reach Flock:Image.from_pilconverts every picture to RGB or RGBA before it saves it. - Patched vulnerable dependencies: anyio, PyJWT, cryptography, urllib3, python-multipart, Starlette, MCP SDK, tornado, gitpython, fsspec, json-repair, mistune, orjson, pymdown-extensions, soupsieve, virtualenv, bleach, idna, multidict, oauthlib, requests, setuptools, pygments, Jupyter and mkdocs-material dev tooling, and the dashboard's dev tooling (Vitest 4, Vite 7.3.7). Removing PyTorch, Transformers and sentence-transformers closes their advisories as well.
- How dependency alerts are handled, including LiteLLM advisories that only affect the LiteLLM proxy server, is documented in CONTRIBUTING.md.
[0.5.700] - 2026-10-06¶
🎉 New Features¶
FlockApplication(flock.application) - transport-independent execution for hosts: typed input, explicit output contract, one isolatedFlockper workflow, incremental outputs, one terminalWorkflowResult(succeeded/failed/cancelled/timed_out), deadlines, cancellation, admission and id-retry protection. See Applications.- Microsoft Foundry hosting (
flock.integrations.foundry, installflock-core[foundry]) - hosts aFlockApplicationas a Microsoft Foundry hosted agent viaazure-ai-agentserver-responses2.1. See Foundry hosted agents. DSPyEngine(max_completion_tokens=...)for reasoning models that rejectmax_tokens.
⚠️ Changes¶
- OpenTelemetry now requires
>=1.43(tested with 1.44; required by the Foundry SDK). The legacyopentelemetry-exporter-jaegerpackages were removed; aTelemetryConfigwithjaeger_endpoint(and the defaultenable_jaeger=True) raises insetup_tracing()- export to Jaeger via OTLP. Flock.shutdown()now cancels in-flight agent tasks (bounded bycancel_grace) before closing MCP connections. No new agent work is scheduled during shutdown; if a task outlives the grace period, the instance stays closed for scheduling.- Scheduled-agent timers start with the first
publish()as well as withrun_until*(). - The trace SQL query endpoint no longer exists; use the remaining trace read endpoints or local DuckDB analysis.
🔒 Security¶
- Removed arbitrary SQL execution from the trace HTTP API and the dashboard: a
SELECTcould read server files through DuckDB table functions despiteread_only=True. The dashboard keeps Timeline, Statistics, RED Metrics, Dependencies, Configuration and Guide; the SQL tab, editor and CSV export are gone. DSPyEngineserialization (model_dump(),model_dump_json()) redacts known credential fields inlm_kwargs(api_key,token,password,authorization, ...) as<redacted>, also in nested values. The original values are still passed todspy.LM(...).
🐛 Fixes¶
- Orchestrator components are initialized exactly once (previously twice after
add_component()or timer auto-registration, or when first publishes raced); anon_initializehook may publish without recursing. - Agent tasks that fail outside the agent run (context building, output persistence) are recorded instead of lost; an agent whose inputs were all deferred is no longer run with empty input.
no_output=Truenow also silences user-builtDSPyEngineinstances.- Flock chains to a previously installed
sys.excepthook.
Releases 0.5.500 to 0.5.610 are described in the GitHub release notes.
[0.5.400] - 2026-02-11¶
🎉 New Features¶
🦞 OpenClaw Integration (Phase 1)¶
First-class OpenClaw agent support — use OpenClaw agents as Flock pipeline agents with the same fluent API:
from flock import Flock
from flock.integrations.openclaw import OpenClawConfig
flock = Flock(openclaw=OpenClawConfig.from_env())
pizza_master = flock.openclaw_agent("codex").consumes(MyPizzaIdea).publishes(Pizza)
Features: - flock.openclaw_agent() — Fluent builder for OpenClaw-backed agents - Spawn mode — Isolated session per invocation, clean context, parallelizable - Env-based config — OPENCLAW_<ALIAS>_URL + OPENCLAW_<ALIAS>_TOKEN auto-discovery - JSON repair — Automatic extraction and retry for malformed agent output - Dashboard badge — 🦞 OpenClaw agents show an orange lobster badge in the graph UI - Zero breaking changes — All existing Flock semantics (blackboard, visibility, fan-out, conditions) work unchanged
New files: - src/flock/integrations/openclaw/ — Config, engine, and package exports - examples/11-openclaw/ — Three example scripts + README - docs/guides/openclaw.md — Comprehensive integration guide - docs/specs/004-openclaw-integration/concept.md — Full design spec (Phases 1–4)
🐛 Fixes¶
- Dashboard publish form now receives list defaults for artifact fields backed by Pydantic
default_factory(array defaults are hydrated in artifact type schema responses), so list textareas prefill correctly.
[0.5.30] - 2025-11-07¶
🎉 New Features¶
⏰ Timer-Based Agent Scheduling¶
Schedule agents to execute periodically or at specific times without requiring artifact triggers:
from datetime import timedelta, time, datetime
from flock import Flock
flock = Flock("openai/gpt-4.1")
# Periodic execution (every 30 seconds)
health_monitor = (
flock.agent("health_monitor")
.description("Monitors system health")
.schedule(every=timedelta(seconds=30))
.publishes(HealthStatus)
)
# Daily execution (5 PM every day)
daily_report = (
flock.agent("daily_report")
.schedule(at=time(hour=17, minute=0))
.publishes(DailyReport)
)
# Cron expression (every weekday at 9 AM UTC)
workday_report = (
flock.agent("workday_report")
.schedule(cron="0 9 * * 1-5") # Mon-Fri at 9 AM
.publishes(WorkdayReport)
)
# One-time execution at specific datetime
reminder = (
flock.agent("reminder")
.schedule(at=datetime(2025, 12, 25, 9, 0)) # Christmas 9 AM
.publishes(Reminder)
)
Features: - Interval-based scheduling - Execute at regular intervals (every=timedelta) - Time-based scheduling - Execute daily at specific time (at=time) - DateTime-based scheduling - One-time execution at specific datetime (at=datetime) - Cron support - Full 5-field cron expressions (UTC timezone) with *, lists, ranges, steps - Initial delay - Wait before first execution (after=timedelta) - Repeat limits - Control execution count (max_repeats=int) - Timer metadata - Access ctx.trigger_type, ctx.timer_iteration, ctx.fire_time in agent context - Context filtering - Combine timers with .consumes() to filter blackboard context
Use cases: - Periodic monitoring (health checks, system status) - Scheduled reports (daily summaries, weekly analytics) - Batch processing (process accumulated data at intervals) - Cleanup tasks (delete old records, archive data) - Time-based alerts (check for stale data, missed deadlines)
Timer Component: - TimerComponent orchestrator component manages timer tasks and state - Automatic timer lifecycle management (startup, shutdown, cancellation) - Timer state tracking (iteration count, last/next fire times) - Background task management with graceful shutdown
Documentation: - Complete scheduling guide (docs/guides/scheduling.md) - Step-by-step tutorial (docs/tutorials/scheduled-agents.md) - 6 production-ready examples (examples/10-scheduling/)
🔧 Server Components Improvements¶
Critical Fix: Orchestrator Component Initialization - Fixed server startup to ensure orchestrator components (like TimerComponent) initialize before HTTP server starts - Prevents timer scheduling failures in dashboard/server mode - Ensures all orchestrator components are ready before accepting requests
Impact: - Scheduled agents now work correctly in flock.serve() mode - Timer components initialize properly in CLI and dashboard modes - No more race conditions between server startup and timer initialization
🔧 API Changes¶
New Methods: - .schedule(every=timedelta) - Periodic execution - .schedule(at=time) - Daily execution at specific time - .schedule(at=datetime) - One-time execution at datetime - .schedule(cron=str) - Cron expression scheduling - .schedule(after=timedelta) - Initial delay before first execution - .schedule(max_repeats=int) - Limit number of executions
New Context Properties (Timer-Triggered Agents): - ctx.trigger_type - "timer" for timer-triggered executions - ctx.timer_iteration - Current iteration count (0, 1, 2, ...) - ctx.fire_time - Datetime when timer fired
Validation: - Scheduled agents must declare .publishes() (enforced at agent creation) - after >= 0 validation (non-negative initial delay) - max_repeats > 0 validation (positive repeat limit) - Cannot combine .schedule() with .batch() (mutually exclusive)
📚 Documentation¶
- Added comprehensive timer scheduling guide (
docs/guides/scheduling.md) - 890+ lines - Added scheduled agents tutorial (
docs/tutorials/scheduled-agents.md) - 1,060+ lines - Added 6 production-ready examples in
examples/10-scheduling/: 01_simple_health_monitor.py- Basic periodic monitoring02_error_log_analyzer.py- Timer + context filtering pattern03_daily_report_generator.py- Daily scheduled reports04_batch_data_processor.py- Periodic batch processing05_one_time_reminder.py- One-time datetime execution06_cron_demo.py- Cron expression examples- Updated
AGENTS.mdwith timer scheduling patterns and best practices
✅ Testing¶
- Added 38 timer component unit tests (
tests/test_timer_component.py) - Added integration tests for scheduled agent workflows (
tests/integration/test_scheduled_agents.py) - Added timer component registration tests (
tests/test_timer_component_registration.py) - Added agent schedule API tests (
tests/test_agent_schedule_api.py) - Added timer tick tests (
tests/test_timer_tick.py) - Added dashboard graph visualization tests for scheduled agents (
tests/test_dashboard_graph.py) - All tests passing with comprehensive coverage
🚀 Dependencies¶
- Added
croniter>=6.0.0for cron expression parsing - Added
python-dotenv>=1.2.1for automatic.envfile loading - Added
types-croniter>=6.0.0.20250809for type hints
🐛 Bug Fixes¶
- Fixed timer scheduling in dashboard mode (orchestrator initialization before server start)
- Fixed duplicate timer task creation (prevented multiple timers for same agent)
- Fixed CLI mode timer support (orchestrator initialization in CLI)
- Fixed frontend TypeScript compilation errors for scheduled agent visualization
- Fixed server component tests to be OS-agnostic
📦 Other Improvements¶
- Automatic
.envfile loading on import (viapython-dotenv) - Improved scheduled agent demo patterns and
run_until_idle()API - Enhanced dashboard visualization for scheduled agents (shows next fire time, iteration count)
- Restructured examples directory (moved patterns to
02-patterns/, added10-scheduling/)
[0.5.2] - 2025-10-19¶
🎉 New Features¶
🌟 Fan-Out Publishing¶
Produce multiple outputs from a single agent execution:
# Generate 10 diverse product ideas from one brief
idea_generator = (
flock.agent("generator")
.consumes(ProductBrief)
.publishes(ProductIdea, fan_out=10) # Produces 10 ideas!
)
# Multi-output fan-out: Generate 3 of EACH type in ONE LLM call!
multi_master = (
flock.agent("multi_master")
.consumes(Idea)
.publishes(Movie, MovieScript, MovieCampaign, fan_out=3)
)
# = 9 total artifacts (3 movies + 3 scripts + 3 campaigns) in one execution!
Features: - Single execution produces N artifacts per type - Quality filtering with where parameter - Validation with validate parameter - Dynamic visibility control per artifact - Massive efficiency: 1 LLM call → multiple validated outputs
Use cases: - Content generation with diversity - A/B testing variants - Code review with multiple bug reports - Multi-perspective analysis
📦 BatchSpec - Cost Optimization¶
Process multiple artifacts efficiently:
# Process 25 transactions in one batch = 96% cost reduction!
payment_processor = flock.agent("payments").consumes(
Transaction,
batch=BatchSpec(size=25, timeout=timedelta(seconds=30))
)
# Hybrid batching: by size OR timeout
analyzer = flock.agent("analyzer").consumes(
LogEntry,
batch=BatchSpec(size=100, timeout=timedelta(minutes=5))
)
Features: - Size-based batching (flush when N artifacts accumulated) - Timeout-based batching (flush after T seconds) - Hybrid mode (whichever comes first) - Automatic batch coordination
Benefits: - 90%+ API cost reduction for bulk operations - Efficient processing of high-volume streams - Natural aggregation patterns
🔗 JoinSpec - Data Correlation¶
Correlate related artifacts within time windows:
# Match orders + shipments by order_id within 24 hours
customer_service = flock.agent("notifications").consumes(
Order,
Shipment,
join=JoinSpec(by=lambda x: x.order_id, within=timedelta(hours=24))
)
# IoT sensor correlation
quality_control = flock.agent("qc").consumes(
TemperatureSensor,
PressureSensor,
join=JoinSpec(by=lambda x: x.device_id, within=timedelta(seconds=30)),
batch=BatchSpec(size=5) # Combine with batching!
)
Features: - Correlation by custom key (e.g., order_id, user_id, device_id) - Time window enforcement - Multi-type correlation support - Composable with BatchSpec for multi-stage pipelines
Use cases: - Order + shipment tracking - Multi-modal data fusion (scans + labs + history) - IoT sensor correlation - Financial trade matching
🧠 Semantic Subscriptions - Intelligence Beyond Keywords¶
Match artifacts by MEANING, not keywords:
# Install semantic extras
pip install flock-core[semantic]
# Agents route based on semantic similarity
security_team = (
flock.agent("security_team")
.consumes(SupportTicket, semantic_match="security vulnerability exploit")
.publishes(SecurityAlert)
)
billing_team = (
flock.agent("billing_team")
.consumes(SupportTicket, semantic_match="payment charge refund billing")
.publishes(BillingResponse)
)
# "SQL injection" → Security Team (no "security" keyword needed!)
# "charged twice" → Billing Team (semantic understanding!)
Advanced semantic filtering:
# Custom threshold (0.0-1.0, default 0.4)
.consumes(Ticket, semantic_match="urgent", semantic_threshold=0.7) # Strict
# Multiple criteria (ALL must match - AND logic)
.consumes(Doc, semantic_match=["security", "compliance"])
# Field-specific matching
.consumes(Article, semantic_match={
"query": "machine learning",
"threshold": 0.6,
"field": "abstract" # Only match this field
})
Semantic Context Provider:
from flock.semantic import SemanticContextProvider
# Find similar historical incidents for context-aware decisions
provider = SemanticContextProvider(
query_text="database connection timeout",
threshold=0.4,
limit=5,
artifact_type=Incident,
where=lambda a: a.payload["resolved"] is True
)
similar_incidents = await provider.get_context(store)
Features: - Local embeddings with all-MiniLM-L6-v2 model (~90MB) - No external API required - Fast with LRU cache (10k entries, ~15ms per embedding) - Threshold control for precision/recall tuning - Field extraction for targeted matching - Multiple predicates with AND logic
Benefits: - No keyword brittleness ("SQL injection" matches "security vulnerability") - Better recall (catches semantically similar content) - Intelligent routing without complex rule systems - Context-aware agents with historical similarity search
Use cases: - Smart ticket routing to specialized teams - Content recommendation based on meaning - Incident response with historical context - Document classification by topic
📚 Documentation¶
- Added comprehensive semantic subscriptions guide (
docs/semantic-subscriptions.md) - Added 4 runnable examples in
examples/08-semantic/: 00_verify_semantic_features.py- Quick verification (no LLM)01_intelligent_ticket_routing.py- Smart routing demo02_multi_criteria_filtering.py- Advanced filtering patterns- Updated README with semantic subscriptions feature
- Added API documentation for all new features
🔧 API Changes¶
New Parameters: - fan_out parameter in .publishes() for multi-output generation - semantic_match parameter in .consumes() for meaning-based matching (replaces text) - semantic_threshold parameter in .consumes() for similarity control (replaces min_p) - batch parameter in .consumes() accepts BatchSpec objects - join parameter in .consumes() accepts JoinSpec objects
Note: The original text and min_p parameters have been renamed to semantic_match and semantic_threshold for clarity. This makes it obvious that matching is semantic (meaning-based), not keyword-based.
✅ Testing¶
- Added 39 semantic subscription tests (100% passing)
- Added fan-out publishing tests
- Added BatchSpec and JoinSpec integration tests
- All 1,435+ tests passing with zero regressions
🚀 Performance¶
- Semantic matching: ~15ms per embedding (CPU)
- Batch processing: ~4.5ms per text with batching
- Cache hit rate: 60-80% typical
- Fan-out efficiency: N outputs in 1 LLM call
Flock 0.5.0 Complete Changelog & Migration Guide¶
Complete architectural rewrite from workflow orchestration to blackboard architecture
Release Date: 12. Oct 2025 Migration Effort: 1-4 weeks depending on system size Backward Compatibility: NONE - This is a ground-up rewrite
Table of Contents¶
- Executive Summary
- Architectural Changes
- Breaking Changes
- New Features
- Migration Guide
- Performance Improvements
- Deprecations & Removals
- Known Limitations
- Upgrade Recommendations
Executive Summary¶
What Changed?¶
Flock 0.5.0 is not an incremental update—it's a complete reimplementation with a fundamentally different architecture:
| Aspect | Flock 0.4 | Flock 0.5 |
|---|---|---|
| Architecture | Workflow orchestration (LangGraph-style) | Blackboard architecture (Hearsay-II-style) |
| Communication | Direct agent-to-agent handoffs | Publish-subscribe via blackboard |
| Execution Model | Sequential by default | Parallel by default |
| Type System | String-based signatures | Pure Pydantic models with @flock_type |
| Routing | Explicit routers with config | Type-based subscription matching |
| State | Mutable FlockContext | Immutable Artifact objects |
| Orchestration | Temporal.io workflows | Event-driven coordination |
| Dependencies | PyTorch + Temporal + Heavy stack | DuckDB + FastAPI + Lean stack |
Why This Change?¶
Workflow orchestration doesn't scale. As agent systems grow: - O(n²) complexity: Every new agent requires updating router configuration - Tight coupling: Agents must know about each other - Sequential bottlenecks: Parallelism requires manual configuration - Testing complexity: Must mock entire workflow graph
Blackboard architecture solves this: - O(n) complexity: Agents subscribe to types, routing is automatic - Loose coupling: Agents only know about data types - Natural parallelism: All matching agents execute concurrently - Testing simplicity: Test agents in isolation with type fixtures
Research validation: Recent studies show blackboard + MCP architectures achieve competitive performance with SOTA multi-agent systems while using fewer tokens (Exploring Advanced LLM Multi-Agent Systems Based on Blackboard Architecture, 2024).
Architectural Changes¶
Core Architecture: Workflow → Blackboard¶
Flock 0.4: Workflow Orchestration¶
Characteristics: - Explicit handoffs between agents - Central orchestrator manages execution - Sequential by default, parallel requires configuration - Tight coupling through router configuration
Flock 0.5: Blackboard Architecture¶
Characteristics: - Publish-subscribe communication - No central orchestrator (event-driven) - Parallel by default, executes all matching agents - Loose coupling through type system
Communication Model¶
0.4: Direct Handoffs¶
# Flock 0.4
class MyAgent(Agent):
async def execute(self, context: FlockContext):
result = await self.process(context.data)
context.set_result(result)
return "next_agent" # Explicit routing
0.5: Publish-Subscribe¶
# Flock 0.5
@flock.agent("my_agent")
.consumes(InputType)
.publishes(OutputType)
.does(process)
async def process(input: InputType) -> OutputType:
# Pure transformation, no routing logic
return OutputType(...)
Execution Model¶
0.4: Imperative Execution¶
# Flock 0.4
context = FlockContext(initial_data)
result = await flock.run(context, entry_agent="start")
# Sequential execution, manual parallelism
0.5: Declarative Execution¶
# Flock 0.5
await flock.publish(UserRequest(query="..."))
await flock.run_until_idle()
# Parallel execution, automatic coordination
Breaking Changes¶
1. Agent Definition¶
Before (0.4)¶
from flock import FlockFactory, Agent, FlockContext
class ResearchAgent(Agent):
def __init__(self, name: str):
super().__init__(name)
self.input_signature = "query: str"
self.output_signature = "findings: List[str]"
async def execute(self, context: FlockContext) -> str:
query = context.data.get("query")
findings = await self.research(query)
context.set_result({"findings": findings})
return "summarizer_agent" # Explicit routing
agent = FlockFactory.create_default_agent(
name="researcher",
description="Research agent",
agent_class=ResearchAgent
)
After (0.5)¶
from flock import flock, flock_type
from pydantic import BaseModel
@flock_type
class Query(BaseModel):
text: str
@flock_type
class Findings(BaseModel):
results: list[str]
async def research_handler(query: Query) -> Findings:
findings = await do_research(query.text)
return Findings(results=findings)
agent = (
flock.agent("researcher")
.consumes(Query)
.publishes(Findings)
.does(research_handler)
)
Key Changes: - ❌ No FlockFactory, Agent base class, or FlockContext - ✅ Fluent builder pattern: flock.agent().consumes().publishes().does() - ✅ Pure Pydantic types with @flock_type decorator - ✅ Functions instead of classes (simpler) - ✅ No explicit routing (type-based)
2. Multi-Agent Coordination¶
Before (0.4): Explicit Routing¶
from flock import Router
# Define explicit routing logic
router = Router()
router.add_route("researcher", "summarizer", lambda ctx: ctx.has_findings())
router.add_route("summarizer", "formatter", lambda ctx: ctx.has_summary())
flock = FlockFactory.create(
agents=[researcher, summarizer, formatter],
router=router,
entry_agent="researcher"
)
After (0.5): Type-Driven Flow¶
# No router needed! Flow emerges from type relationships
# Researcher consumes Query, publishes Findings
researcher = flock.agent("researcher").consumes(Query).publishes(Findings).does(research)
# Summarizer consumes Findings, publishes Summary
summarizer = flock.agent("summarizer").consumes(Findings).publishes(Summary).does(summarize)
# Formatter consumes Summary, publishes Report
formatter = flock.agent("formatter").consumes(Summary).publishes(Report).does(format)
# Flow: Query → researcher → Findings → summarizer → Summary → formatter → Report
# No explicit routing config needed!
Key Changes: - ❌ No Router class or route configuration - ✅ Type system defines flow automatically - ✅ Add/remove agents without touching router - ✅ Natural composition through type matching
3. Execution & Result Retrieval¶
Before (0.4): Direct Access¶
# Flock 0.4
context = FlockContext({"query": "AI trends"})
result = await flock.run(context, entry_agent="researcher")
# Direct access to result
findings = result.data.get("findings")
After (0.5): Store Queries¶
# Flock 0.5
from flock.store import FilterConfig
# Publish input
await flock.publish(Query(text="AI trends"))
# Wait for completion
await flock.run_until_idle()
# Query the blackboard store
findings_artifacts = await flock.store.query_artifacts(
FilterConfig(type_names={"Findings"}),
limit=10
)
findings = findings_artifacts[0].payload
Key Changes: - ❌ No direct result access via return value - ✅ Results stored in persistent blackboard - ✅ Query by type, producer, tags, time range, etc. - ✅ Full audit trail of all artifacts
4. Tools & External Integration¶
Before (0.4): Modules¶
# Flock 0.4
from flock import Module
class WebSearchModule(Module):
async def search(self, query: str) -> list[str]:
# Implementation
pass
flock = FlockFactory.create(
agents=[...],
modules=[WebSearchModule()]
)
After (0.5): MCP Servers & Custom Tools¶
# Flock 0.5 - Custom Tools
from flock import flock_tool
@flock_tool
async def web_search(query: str) -> list[str]:
"""Search the web for information."""
# Implementation
pass
# Or use MCP servers (external processes)
flock.with_mcp_server(
name="brave-search",
command="npx",
args=["-y", "@modelcontextprotocol/server-brave-search"]
)
Key Changes: - ❌ No Module concept - ✅ Simple @flock_tool decorator for custom tools - ✅ MCP (Model Context Protocol) for external tools - ✅ Tools run in separate processes (better isolation)
5. Configuration & Setup¶
Before (0.4): Factory Pattern¶
# Flock 0.4
from flock import FlockFactory, TemporalConfig
flock = FlockFactory.create(
agents=[agent1, agent2],
router=router,
temporal_config=TemporalConfig(
host="localhost:7233",
namespace="default"
),
entry_agent="agent1"
)
After (0.5): Fluent Builder¶
# Flock 0.5
from flock import Flock
flock = (
Flock.builder()
.with_agent(agent1)
.with_agent(agent2)
.with_tool(custom_tool)
.with_mcp_server(name="brave", command="npx", args=[...])
.build()
)
# Or use default orchestrator
await flock.publish(initial_artifact)
await flock.run_until_idle()
Key Changes: - ❌ No FlockFactory, TemporalConfig - ✅ Fluent builder: Flock.builder().with_agent().with_tool().build() - ✅ No Temporal.io configuration (removed dependency) - ✅ Simpler default setup
New Features¶
1. Real-Time Dashboard¶
Location: http://localhost:3000 (when running flock dashboard)
Features: - Dual Visualization Modes: - Agent View: Network graph showing agent relationships and message flows - Blackboard View: Data lineage graph showing artifact transformations - WebSocket Streaming: Zero-lag updates as agents execute - Trace Viewer: 7 visualization modes (Timeline, Waterfall, Gantt, Flamegraph, Sunburst, Icicle, Sankey) - SQL Query Interface: AI-queryable telemetry via DuckDB - Agent Metrics: Real-time message counts, execution status, streaming tokens - Artifact Inspector: Inspect artifact payloads, metadata, consumption chains
Example:
# Terminal 1: Start dashboard
flock dashboard
# Terminal 2: Run your agents
python my_agent_system.py
# Browser: Open http://localhost:3000
# Watch agents execute in real-time!
2. Type-Safe Contracts with @flock_type¶
Pure Pydantic models replace string-based signatures:
from flock import flock_type
from pydantic import BaseModel, Field
from datetime import datetime
@flock_type
class UserRequest(BaseModel):
"""User's research request."""
query: str = Field(description="Search query")
max_results: int = Field(default=10, ge=1, le=100)
timestamp: datetime = Field(default_factory=datetime.utcnow)
@flock_type
class ResearchFindings(BaseModel):
"""Research results."""
query: str
sources: list[str]
summary: str
confidence: float = Field(ge=0.0, le=1.0)
Benefits: - ✅ Compile-time validation: Catch type errors before runtime - ✅ Auto-generated docs: Pydantic models document themselves - ✅ IDE support: Full autocomplete and type checking - ✅ Canonical names: __main__.UserRequest with aliases for flexibility
3. Visibility Controls (Zero-Trust Security)¶
5 Visibility Types for multi-tenant systems:
Public Visibility¶
from flock.core.visibility import PublicVisibility
@flock_type
class PublicAnnouncement(BaseModel):
message: str
visibility: PublicVisibility = PublicVisibility()
# Any agent can consume this
Private Visibility¶
from flock.core.visibility import PrivateVisibility
@flock_type
class PrivateNote(BaseModel):
content: str
visibility: PrivateVisibility = PrivateVisibility(producer_id="agent-123")
# Only the producer can consume this
Tenant Visibility¶
from flock.core.visibility import TenantVisibility
@flock_type
class PatientData(BaseModel):
patient_id: str
diagnosis: str
visibility: TenantVisibility = TenantVisibility(tenant_id="hospital-abc")
# Only agents with tenant_id="hospital-abc" can consume
Labelled Visibility¶
from flock.core.visibility import LabelledVisibility
@flock_type
class InternalReport(BaseModel):
data: dict
visibility: LabelledVisibility = LabelledVisibility(required_labels={"clearance:secret", "dept:engineering"})
# Only agents with BOTH labels can consume
After Visibility¶
from flock.core.visibility import AfterVisibility
from datetime import datetime, timedelta
@flock_type
class ScheduledMessage(BaseModel):
content: str
visibility: AfterVisibility = AfterVisibility(
available_after=datetime.utcnow() + timedelta(hours=1)
)
# Only visible after the specified timestamp
4. Persistent Blackboard Store¶
SQLite-backed storage with full audit trail:
from flock.store import SQLiteBlackboardStore
store = SQLiteBlackboardStore(db_path=".flock/blackboard.db")
# Query artifacts by type
from flock.store import FilterConfig
artifacts = await store.query_artifacts(
FilterConfig(
type_names={"UserRequest"},
tags={"priority:high"},
start=datetime(2024, 1, 1),
end=datetime(2024, 12, 31)
),
limit=100
)
# Get consumption history
consumptions = await store.get_consumptions(artifact_id="artifact-123")
Features: - ✅ Every artifact persisted with metadata - ✅ Consumption tracking (who consumed what, when) - ✅ Tag-based filtering - ✅ Time-range queries - ✅ Correlation ID tracking for request chains
5. Production Safety Features¶
Circuit Breakers¶
from flock import Flock
flock = (
Flock.builder()
.with_agent(agent)
.with_circuit_breaker(
failure_threshold=5,
timeout_seconds=30,
half_open_after_seconds=60
)
.build()
)
Feedback Prevention¶
agent = (
flock.agent("analyzer")
.consumes(Report)
.publishes(Analysis)
.prevents_feedback() # Prevents consuming its own output
.does(analyze)
)
Execution Limits¶
await flock.run_until_idle(
max_cycles=100, # Prevent infinite loops
timeout_seconds=300 # 5 minute timeout
)
6. AI-Queryable Telemetry (DuckDB + OpenTelemetry)¶
DuckDB storage for traces:
# Dashboard SQL interface allows queries like:
SELECT
service_name,
span_name,
AVG(duration_ns / 1000000) as avg_duration_ms,
COUNT(*) as call_count
FROM spans
WHERE timestamp > NOW() - INTERVAL '1 hour'
GROUP BY service_name, span_name
ORDER BY avg_duration_ms DESC
LIMIT 10;
Features: - ✅ 10-100x faster than SQLite for analytical queries - ✅ Jaeger-compatible traces (OpenTelemetry) - ✅ SQL interface in dashboard - ✅ AI-queryable: LLMs can write queries to analyze system behavior
7. MCP (Model Context Protocol) Integration¶
Extensible tool ecosystem:
# Use community MCP servers
flock.with_mcp_server(
name="brave-search",
command="npx",
args=["-y", "@modelcontextprotocol/server-brave-search"],
env={"BRAVE_API_KEY": os.getenv("BRAVE_API_KEY")}
)
# Or build your own
@flock_tool
async def custom_tool(param: str) -> str:
"""Custom tool implementation."""
return f"Processed: {param}"
Benefits: - ✅ Tools run in separate processes (better isolation) - ✅ Language-agnostic (write tools in any language) - ✅ Community ecosystem (growing library of MCP servers) - ✅ Hot-reload support (update tools without restarting)
Migration Guide¶
Step-by-Step Migration¶
Step 1: Update Dependencies¶
# Uninstall old version
pip uninstall flock-core
# Install new version
pip install flock-core==0.5.0
Step 2: Convert Types¶
Before:
class MyAgent(Agent):
def __init__(self):
self.input_signature = "query: str, max_results: int"
self.output_signature = "results: List[str], confidence: float"
After:
from flock import flock_type
from pydantic import BaseModel
@flock_type
class Query(BaseModel):
query: str
max_results: int = 10
@flock_type
class Results(BaseModel):
results: list[str]
confidence: float
Step 3: Convert Agents¶
Before:
class MyAgent(Agent):
async def execute(self, context: FlockContext) -> str:
data = context.data
result = await self.process(data)
context.set_result(result)
return "next_agent"
After:
async def my_handler(input: Query) -> Results:
result = await process(input)
return Results(results=result, confidence=0.9)
agent = (
flock.agent("my_agent")
.consumes(Query)
.publishes(Results)
.does(my_handler)
)
Step 4: Remove Router Configuration¶
Before:
router = Router()
router.add_route("agent1", "agent2", condition)
router.add_route("agent2", "agent3", condition)
After:
# No router needed! Define agents with type contracts:
agent1 = flock.agent("agent1").consumes(TypeA).publishes(TypeB).does(handler1)
agent2 = flock.agent("agent2").consumes(TypeB).publishes(TypeC).does(handler2)
agent3 = flock.agent("agent3").consumes(TypeC).publishes(TypeD).does(handler3)
# Flow emerges from type relationships: TypeA → TypeB → TypeC → TypeD
Step 5: Update Execution¶
Before:
context = FlockContext({"query": "search term"})
result = await flock.run(context, entry_agent="researcher")
findings = result.data.get("findings")
After:
from flock.store import FilterConfig
# Publish input
await flock.publish(Query(query="search term"))
# Wait for completion
await flock.run_until_idle()
# Query results
artifacts = await flock.store.query_artifacts(
FilterConfig(type_names={"Results"}),
limit=1
)
results = artifacts[0].payload # Results object
Step 6: Replace Modules with Tools¶
Before:
After:
Complete Example Migration¶
Flock 0.4: Research Assistant¶
# research_assistant_04.py (Flock 0.4)
from flock import FlockFactory, Agent, FlockContext, Router, Module
class WebSearchModule(Module):
async def search(self, query: str) -> list[str]:
# Web search implementation
return ["result1", "result2"]
class ResearchAgent(Agent):
def __init__(self):
super().__init__("researcher")
self.input_signature = "query: str"
self.output_signature = "findings: List[str]"
async def execute(self, context: FlockContext) -> str:
query = context.data["query"]
search = context.get_module(WebSearchModule)
findings = await search.search(query)
context.set_result({"findings": findings})
return "summarizer"
class SummarizerAgent(Agent):
def __init__(self):
super().__init__("summarizer")
self.input_signature = "findings: List[str]"
self.output_signature = "summary: str"
async def execute(self, context: FlockContext) -> str:
findings = context.data["findings"]
summary = " | ".join(findings)
context.set_result({"summary": summary})
return "END"
# Setup
router = Router()
router.add_route("researcher", "summarizer", lambda ctx: "findings" in ctx.data)
flock = FlockFactory.create(
agents=[ResearchAgent(), SummarizerAgent()],
modules=[WebSearchModule()],
router=router,
entry_agent="researcher"
)
# Execute
context = FlockContext({"query": "AI trends"})
result = await flock.run(context)
print(result.data["summary"])
Flock 0.5: Research Assistant¶
# research_assistant_05.py (Flock 0.5)
from flock import Flock, flock, flock_type, flock_tool
from pydantic import BaseModel
# Types
@flock_type
class Query(BaseModel):
text: str
@flock_type
class Findings(BaseModel):
results: list[str]
@flock_type
class Summary(BaseModel):
text: str
# Tools
@flock_tool
async def web_search(query: str) -> list[str]:
"""Search the web."""
# Same implementation
return ["result1", "result2"]
# Agents
async def research_handler(query: Query, tools) -> Findings:
results = await tools.web_search(query.text)
return Findings(results=results)
async def summarize_handler(findings: Findings) -> Summary:
summary = " | ".join(findings.results)
return Summary(text=summary)
researcher = flock.agent("researcher").consumes(Query).publishes(Findings).does(research_handler)
summarizer = flock.agent("summarizer").consumes(Findings).publishes(Summary).does(summarize_handler)
# Setup
orchestrator = (
Flock.builder()
.with_agent(researcher)
.with_agent(summarizer)
.with_tool(web_search)
.build()
)
# Execute
from flock.store import FilterConfig
await orchestrator.publish(Query(text="AI trends"))
await orchestrator.run_until_idle()
# Get results
summaries = await orchestrator.store.query_artifacts(
FilterConfig(type_names={"Summary"}),
limit=1
)
print(summaries[0].payload.text)
Key Differences: 1. ❌ No FlockFactory, FlockContext, Router 2. ✅ Pydantic types with @flock_type 3. ✅ Simple functions instead of Agent classes 4. ✅ Fluent builder pattern 5. ✅ Store queries instead of direct access 6. ✅ Type-driven flow (no router config)
Performance Improvements¶
Resource Usage¶
| Metric | Flock 0.4 | Flock 0.5 | Improvement |
|---|---|---|---|
| Install Size | ~3.2 GB | ~650 MB | 80% reduction |
| Dependencies | 47 packages | 23 packages | 51% reduction |
| PyTorch | Required | Removed | ✅ |
| Agent Handoff | ~100-500ms | <1ms | 100-500x faster |
| Routing Complexity | O(n²) | O(n) | Linear scaling |
Why So Much Faster?¶
- No PyTorch: Removed 2.5GB dependency not needed for orchestration
- No Temporal.io: Event-driven coordination is lightweight
- Zero-copy messaging: Artifacts stored once, referenced by ID
- Parallel execution: All matching agents run concurrently
- DuckDB: 10-100x faster than SQLite for analytical queries
Benchmark: 10-Agent Pipeline¶
| Metric | Flock 0.4 | Flock 0.5 |
|---|---|---|
| Sequential execution | 5.2s | 0.8s |
| With parallelism | 3.1s | 0.2s |
| Memory usage | 450 MB | 90 MB |
Deprecations & Removals¶
Removed Components¶
Temporal.io Integration¶
- Reason: Heavy dependency, not needed for event-driven coordination
- Migration: Use
flock.publish()+run_until_idle()
PyTorch Dependency¶
- Reason: Only needed for embeddings, not core orchestration
- Migration: Use external MCP servers for embeddings if needed
Router Class¶
- Reason: Type system provides automatic routing
- Migration: Define type contracts with
.consumes()and.publishes()
FlockContext¶
- Reason: Mutable state doesn't fit event-driven model
- Migration: Use immutable
Artifactobjects, query store for results
Agent Base Class¶
- Reason: Functions are simpler than classes for agent logic
- Migration: Use async functions with
.does(handler)
Module System¶
- Reason: MCP provides better tool isolation
- Migration: Use
@flock_toolor MCP servers
String Signatures¶
- Reason: No type safety, error-prone
- Migration: Use Pydantic models with
@flock_type
Known Limitations¶
Beta Features¶
- SQLiteBlackboardStore: Marked as beta, may have performance issues at scale
- Dashboard OAuth: No authentication yet (local use only)
- Redis Backend: Not yet implemented (roadmap item)
Not Yet Supported¶
- Kafka/RabbitMQ Integration: Planned for 1.0
- Kubernetes-Native Deployment: Planned for 1.0
- Multi-Tenant Dashboard: Single tenant only
- Advanced Analytics: Basic metrics only
- RBAC: No role-based access control yet
Migration Challenges¶
- No Backward Compatibility: Complete rewrite required
- Async Everywhere: Must use async/await throughout
- Learning Curve: New patterns take time to internalize
- Example Dependencies: Most examples require API keys
Upgrade Recommendations¶
When to Upgrade¶
✅ Upgrade Immediately If:¶
- Starting a new project
- Need parallel agent execution (10+ agents)
- Require type safety and compile-time validation
- Want production observability (dashboard, traces)
- Building multi-tenant systems (need visibility controls)
- Resource constraints (80% reduction in dependencies)
⏳ Wait for 1.0 If You Need:¶
- Enterprise persistence (Redis, Kafka)
- Kubernetes-native deployment
- OAuth/RBAC for dashboard
- Multi-tenant SaaS features
- Proven 99.99% uptime
⚠️ Stay on 0.4 If:¶
- Heavily invested in Temporal.io workflows
- Sequential execution sufficient
- Production system is stable
- Migration cost > benefits
- Team has no bandwidth for rewrite
Migration Timeline¶
| System Size | Agents | Est. Time | Complexity |
|---|---|---|---|
| Small | 1-5 | 1-2 days | Low |
| Medium | 6-20 | 1 week | Medium |
| Large | 21-50 | 2-3 weeks | High |
| Enterprise | 50+ | 4+ weeks | Very High |
Factors affecting timeline: - Complexity of router logic - Number of custom modules - Amount of FlockContext usage - Test coverage requirements - Team familiarity with async/Pydantic
FAQ¶
Q: Is there ANY backward compatibility?¶
A: No. Flock 0.5 is a complete architectural rewrite with zero shared code.
Q: Why not call this Flock 2.0?¶
A: The team considers 0.5 a "production-ready core" but reserves 1.0 for enterprise features (Kafka, K8s, OAuth, Redis). This follows semantic versioning where 0.x.x allows API evolution.
Q: Can I run 0.4 and 0.5 side by side?¶
A: Yes, but not recommended. They use different package names internally, but share the flock namespace. Use separate virtual environments.
Q: Where's the migration tooling?¶
A: No automated migration tools exist (yet). The architectural differences are too fundamental for code transformation.
Q: What about Temporal workflows?¶
A: Temporal is completely removed. If you need durable workflows, consider staying on 0.4 or using Temporal separately.
Q: How stable is the API?¶
A: Core API is stable. Minor changes may occur before 1.0, but no more ground-up rewrites.
Q: Will you maintain 0.4?¶
A: Critical bug fixes only. No new features. Focus is on 0.5 → 1.0.
Resources¶
- API Documentation: docs.flock.io
- Examples:
examples/directory (34+ working examples) - Migration Support: GitHub Discussions
- Roadmap: ROADMAP.md
- Changelog: This document
- Release Notes: GitHub Releases
Acknowledgments¶
This release represents months of research into production agent systems, blackboard architecture patterns, and modern multi-agent frameworks.
Special thanks to: - The Hearsay-II team (1970s) for pioneering blackboard architecture - LangGraph, AutoGen, and CrewAI for inspiring the original 0.4 - The MCP team for creating an extensible tool ecosystem - Our early adopters who helped shape 0.5 through feedback
Philosophy shift:
"Workflow orchestration made sense when we thought of agents as steps in a pipeline. But agents are more like microservices—they should communicate through events, not hardcoded calls."
The future of agent systems is decentralized, type-safe, and observable. Flock 0.5 gets us there.
Built with ❤️ by the Flock team