WBAL
Weights & Biases Agent Library — a compact framework for wiring LLM agents, environments, and tools.
What’s inside
- Agent loop:
Agentimplements the perceive → invoke → do cycle.OpenAIWBAgentis the reference implementation tuned for the OpenAI Responses API (addsexit(), reasoning/message rendering, optional parallel tool calls). - Environments:
Environmentis the base;DataEnvadds persisted notes/observations;PollEnvadds write tools;ChatEnvadds achat()tool and input gating. Configured variants can attach tools from importable modules. - LM adapters:
OpenAIResponsesLM,GPT5Large,GPT5MiniTester,ScriptedLM(deterministic), andKimiK2LM(W&B Inference chat-completions). - YAML-first agents:
YamlAgent+AgentManifest/PromptManifestwire prompts, LMs, env kind, tool modules, and explicit delegates (run_agent/list_agents). - CLI + bundles:
wbalCLI runs chat/poll/baseline or YAML agents and validates/runs WandBSwarm-compatible bundles (run.sh+ optionalinstall.sh).
Installation
- Python
>=3.13,<3.14 - LLMs require
OPENAI_API_KEY(andWANDB_API_KEYforKimiK2LM)
From PyPI:
pip install wbal
From source:
git clone <this-repo>
cd wbal
uv sync
Quick start (code)
import os
import weave
from wbal import GPT5MiniTester, OpenAIWBAgent, weaveTool
from wbal.environments.chat_env import ChatEnv
weave.init(os.getenv("WEAVE_PROJECT", "my-project"))
class MyEnv(ChatEnv):
env = "You are a helpful assistant."
include_working_directory_listing = False
@weaveTool
def greet(self, name: str) -> str:
"""Greet someone by name."""
return f"Hello, {name}!"
env = MyEnv(task="Use greet to say hello to Alice, then call exit().", working_directory="./.wbal_state")
agent = OpenAIWBAgent(
env=env,
lm=GPT5MiniTester(),
maxSteps=10,
system_prompt="Use tools when helpful. Call exit() when you're done.",
)
agent.run()
CLI (high level)
# Baseline (non-interactive) run
wbal run --project myproj --task "Say hello"
# Interactive chat
wbal chat --project myproj --task "Help the user"
# Polling loop (optionally on an interval)
wbal poll --project myproj --task "Check status" --interval 300
# YAML-first (recommended)
wbal agents run --spec path/to/agent.yaml --task "Do the thing"
wbal agents validate --spec path/to/agent.yaml
wbal agents list --dir examples/agents
# Bundles (WandBSwarm contract: run.sh required, install.sh optional)
wbal bundle validate --agent-dir path/to/agent
wbal bundle run --agent-dir path/to/agent --task-dir ./task --workspace-dir ./workspace
wbal bundle shell --agent-dir path/to/agent --task-dir ./task --workspace-dir ./workspace
Common YAML flags: --var KEY=VALUE (prompt templating), --set PATH=VALUE (override instantiated fields), --env KEY=VALUE (env vars before load), --weave-project, --metadata-out.
YAML agents (essentials)
wbal.manifests.AgentManifest fields:
name: orchestrator
description: Optional summary
prompt: prompts/orchestrator.prompt.yaml # or set system_prompt/system_messages inline
lm:
kind: openai_responses # or gpt5_large, gpt5_mini, scripted
model: gpt-5-mini
temperature: 1.0
reasoning: { effort: minimal }
env:
kind: poll # basic | data | chat | poll
env: "Context shown to the agent"
working_directory: ./.wbal_state
include_working_directory_listing: true
include_tools_in_observe: false
tools:
env: [wbal.tools.bash] # import specs; merged with env methods
agent: [] # import specs; merged with agent methods
delegates: # explicit subagents for run_agent()
researcher: worker_research.agent.yaml
share_working_directory: true
max_steps: 30
tool_timeout: 60
parallel_tool_calls: true
max_concurrent_tool_calls: 4
Template vars (--var key=val) render {key} placeholders in prompts/env fields. Delegates resolve relative to the manifest path.
Components (exports)
from wbal import (
# Core primitives
WBALObject, Agent, Environment, StatefulEnvironment, LM,
# Environments
DataEnv, ChatEnv, PollEnv,
# Agents
OpenAIWBAgent, YamlAgent, ExitableAgent,
# LMs
GPT5Large, GPT5MiniTester, OpenAIResponsesLM, ScriptedLM, KimiK2LM,
# Manifests + runner
AgentManifest, PromptManifest, build_agent_from_file, load_agent_manifest,
load_prompt_manifest, run_agent_spec,
# Tooling
tool, weaveTool, get_tools, extract_tool_schema, to_openai_tool, to_anthropic_tool,
format_openai_tool_response, tool_timeout, ToolTimeoutError,
# Bundles
AgentBundleEntry, validate_agent_bundle, run_agent_bundle, shell_agent_bundle,
)
Examples
examples/simple_example.py— minimal ChatEnv + OpenAIWBAgent.examples/zagent_v1.py— orchestrator-style agent with persistent notes and bash tool wiring.examples/agents/— YAML manifests (baseline, orchestrator with delegates, worker agents + prompts).examples/story_summarizer.py— custom Agent/Environment pair that reads files and summarizes.examples/bundles/hello_bundle— minimal bundle exercising the WandBSwarm contract.
Run an example:
uv run python examples/zagent_v1.py --task "Inspect this repo, take notes, then exit()"
Testing
uv run pytest
Documentation
- USER.md — usage guide and API reference
- DEVELOPER.md — architecture and contribution notes
- Agent_Instructions.md — building agents/environments
Metadata
Release files for wbal 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wbal-0.6.0.tar.gz | 132.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wbal-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 177.6 kB
Release files / wbal-0.6.0.tar.gz
| Download URL | wbal-0.6.0.tar.gz |
|---|---|
| Size | 132.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8cdf343876761e8fbad90bfc319f8d6881edeba5d6119762db54476355d6c5a
|
|
BLAKE2b-256 checksum How to use checksums |
4ff934ed871fde8faa6102543e39fd1b950bcacb03c79b275ba218084becde56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / wbal-0.6.0-py3-none-any.whl
| Download URL | wbal-0.6.0-py3-none-any.whl |
|---|---|
| Size | 45.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2a2b037770b1ffd5aea8b8b08f9b0673f9ae3769e78813858403af1aae8a53d
|
|
BLAKE2b-256 checksum How to use checksums |
2cfd362691a11eab0719f6104679270c806da3398e203045e3805c85a571974c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|