Skip to main content

Weaveflow: composable AI agents with a universal interface. Connect any framework (LangChain, CrewAI, or any Python callable) with no rewrite.

Project description

Weaveflow: composable AI agent framework

USB for AI agents. Build an agent once against an open contract, and connect it to any other compliant agent, regardless of LLM, language, or host.

Weaveflow is a Python framework for building composable AI agents. Every agent exposes typed input/output ports and capability tags as its public interface; its brain (LLM), memory, and tools stay private. Any agent's output can plug into any compatible agent's input, and when types are compatible but not identical, Weaveflow auto-injects a transform.

from weaveflow import agent, DataType, Pipeline

@agent(name="summarizer", input=DataType.TEXT, output=DataType.TEXT,
       tags=["summarization"], llm="anthropic:claude-opus-4-8")
async def summarize(ctx):
    return await ctx.complete(f"Summarize:\n{ctx.input.value}")

result = await Pipeline([summarize]).run("a long document ...")

Why Weaveflow

Problem today Weaveflow
Agents are locked to one framework Open port contract; any compliant agent connects
LLM vendor lock-in Swap brains via a "provider:model" string
Custom glue code between agents Connection protocol validates + auto-transforms handoffs
Hard to test multi-agent chains In-process LocalRunner with per-hop tracing

Install

# minimal core (zero runtime deps) + one provider:
pip install "weaveflow[anthropic]"

The core has no runtime dependencies. Provider SDKs are optional extras: weaveflow[openai], weaveflow[anthropic], weaveflow[google], weaveflow[mistral], weaveflow[ollama], weaveflow[deepseek], weaveflow[all].

Quickstart

from weaveflow import agent, DataType, Pipeline, Parallel, LocalRunner

# Define an agent: a decorator (ergonomic) or a BaseAgent subclass (full control).
@agent(name="x", input=DataType.TEXT, output=DataType.TEXT, llm="openai:gpt-4o")
async def x(ctx): ...

# Compose in series:
pipe = Pipeline([cleaner, extractor, summarizer], llm="anthropic:claude-opus-4-8")
out = await pipe.run("raw input")

# Fan-out / fan-in (runs branches concurrently, then merges). Parallel is itself a
# BaseAgent, so it nests inside a Pipeline:
pipe = Pipeline([cleaner, Parallel([analyze_a, analyze_b]), report])

# Trace every hop in-process, no network:
trace = await LocalRunner().simulate([cleaner, extractor], "raw input")
for hop in trace.hops:
    print(hop.agent, hop.output.value, hop.elapsed_ms)

Standard data types

text, structured_json, image, code, audio, document, embedding, stream.

Swap LLM backends

Pass any "provider:model" string; set the matching API key env var (OPENAI_API_KEY, ANTHROPIC_API_KEY, …). Ollama runs locally and needs none.

"openai:gpt-4o" · "anthropic:claude-opus-4-8" · "google:gemini-1.5-pro"
"mistral:mistral-large-latest" · "deepseek:deepseek-chat" · "ollama:llama3"

Connect a foreign agent, no rewrite

If you can call it from Python, you can connect it to Weaveflow. Already have an agent in LangChain, LangGraph, or CrewAI? Wrap it and plug it in, and the handoff auto-calibrates. Anything else (a plain function, a bound method, an HTTP or SDK call) goes through from_callable, the universal escape hatch.

from weaveflow import from_langchain, from_crewai, from_callable, Pipeline

theirs = from_langchain(their_langchain_chain)   # also works with LangGraph graphs
out = await Pipeline([theirs, my_weaveflow_agent]).run("...")   # connected, no rebuild

# or any function / SDK call:
agent = from_callable(lambda text: external_sdk.run(text), name="legacy")

See docs/guide-interop.md.

CLI

weaveflow scaffold my-agent           # create a starter agent file
weaveflow validate my_agent.py        # validate ports + print manifest
weaveflow package my_agent.py         # portable .weaveflow.zip (code + manifest.json)

Documentation

Full guides — agents, LLM backends, memory, guardrails, connections, and interop — live in docs/. Runnable templates are in example-agents/.

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weaveflow-2.0.1.tar.gz (122.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weaveflow-2.0.1-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file weaveflow-2.0.1.tar.gz.

File metadata

  • Download URL: weaveflow-2.0.1.tar.gz
  • Upload date:
  • Size: 122.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for weaveflow-2.0.1.tar.gz
Algorithm Hash digest
SHA256 ce1fdb6e1ddbe918878bbf229372f8926a4dff53b6697d5dc75c20bffd14e266
MD5 99af1aa93c2f65d68d36618822ec61b0
BLAKE2b-256 9f571c33c020940693acaa0b0027a628e1df08bb1f0809e174efe668bec5caf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for weaveflow-2.0.1.tar.gz:

Publisher: release.yml on TheDeveloperDoctor/weave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file weaveflow-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: weaveflow-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 49.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for weaveflow-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4ee1d9c1da4925a51811aae00a57c66316eb7a742f5fa3461a07a25f86a9adc
MD5 dbb0f6edabd1976b1d80721e4c4aa492
BLAKE2b-256 a5c833acde5475d336e97cb59ee0a0e30e4e84660d1ef87f565ac482230eedc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for weaveflow-2.0.1-py3-none-any.whl:

Publisher: release.yml on TheDeveloperDoctor/weave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page