Examples
Reference implementation patterns and use-cases.
Executable Examples Workspace
The Weave repository includes a dedicated examples/ workspace containing standalone, production-ready code projects demonstrating core capabilities.
Workspace Index
| Example Project | Demonstrated Feature | Source Path | CLI Run Command |
|---|---|---|---|
| basic-agent | Single tool registration, debug logger, trace metrics | examples/basic-agent/index.ts | pnpm --filter basic-agent start |
| multi-agent-handoff | Sub-agent routing and context preservation | examples/multi-agent-handoff/index.ts | pnpm --filter multi-agent-handoff start |
| structured-output | Zod output validation and automated self-repair | examples/structured-output/index.ts | pnpm --filter structured-output start |
| streaming-chat | Async event stream iteration via agent.stream() | examples/streaming-chat/index.ts | pnpm --filter streaming-chat start |
Running Examples Locally
To run any example project on your local machine:
Clone Repository & Install Dependencies
git clone https://github.com/sundaram26/Weave.git
cd Weave
pnpm installSet Environment API Keys
export OPENAI_API_KEY="sk-proj-..."Run Target Example
pnpm --filter basic-agent start