Haris Ahmed
Contact
All projects2026

Weaveflow, a Composable AI Agent Framework

USB, but for AI agents. Build an agent once against an open port contract, then snap it together with any other compliant agent, no matter the LLM, language, or host. When two ports almost match, Weaveflow quietly drops in a transform so the handoff still works.

Visit live
¶ Overview
Weaveflow is a Python framework for building AI agents that actually click together. Each agent exposes typed input/output ports and capability tags, while its brain (the LLM), memory, and tools stay private, so one agent's output feeds straight into another's input. If two ports are compatible but not identical, it auto injects a transform to smooth over the mismatch. It's for developers wiring up multi agent systems who are sick of framework lock in and hand written glue. Already have something in LangChain, LangGraph, or CrewAI? Wrap it in one line and it composes like a native agent, and any plain Python callable works too. The core has zero runtime dependencies, with provider SDKs as optional extras across six LLM backends: OpenAI, Anthropic, Google, Mistral, DeepSeek, and Ollama. A CLI scaffolds, validates, and packages agents into portable .weave.zip bundles.
¶ Important info
Production stable at v2.0.0, Apache 2.0, Python 3.10 and up. Around 2,400 lines of library code held at 100% statement and branch coverage, with an 80% floor in CI, plus mypy strict and ruff. The detail I'm proudest of: the core carries zero hard runtime dependencies. Every interop bridge is duck typed, calling a foreign object's documented ainvoke/invoke entrypoint instead of importing the framework, so connecting a LangChain or CrewAI agent never drags those frameworks into Weaveflow's dependency tree. The 2.0.0 release was a deliberate breaking rename of the import package to clear a PyPI namespace collision.
¶ Problem faced
Running one agent is easy. The hard part is getting very different agents to connect safely without a pile of glue, while keeping the core dependency free. Two problems feed each other. First, an agent that emits text might hand off to one expecting structured JSON; the types are compatible but not the same, so wiring them directly either blows up or silently passes malformed data. Second, supporting LangChain, CrewAI, and arbitrary callables usually means importing those heavy frameworks into your core, which kills the zero dependency promise. Doing both at once, self calibrating handoffs and framework agnostic interop, without an if/elif explosion or dependency bloat, is the real puzzle.
¶ How it was solved
Two calls shaped it. Type compatibility lives in a declared directed lookup map (source type to the set of targets it can feed), never an if/elif chain, so a new compatible pair is just data. A four step protocol runs on every handoff: match type, validate shape, pre check capabilities, inject a transform if needed, then re validate against the target port before delivery. And the interop bridges are duck typed: they find a foreign object's async entrypoint (or run a sync one in a worker thread via asyncio.to_thread), wrap it as a real BaseAgent, and never import the framework. The trade offs are honest: duck typing gives up static guarantees on foreign objects for a clean dependency boundary, and the transform adds an LLM call only on hops where types actually differ. Bonus, Pipeline and Parallel are themselves BaseAgents, so compositions nest as deep as you like.
¶ Stack
  • Python
  • asyncio
  • hatchling
  • pytest
  • mypy
  • ruff
  • OpenAI
  • Anthropic SDK
  • Google Generative AI
  • MkDocs
  • Docker
Live site
Back to all projects
Haris Ahmed

AI engineer building intelligent systems that survive production. Available for roles & contract work.

Back to top
IndexAboutStackWorkWritingPathContact
ElsewhereGitHubLinkedInEmail
© 2026 Haris Ahmed · All rights reservedAI systems that actually scale.