Skip to main content

Weights & Biases Agent Library - A minimal framework for building LLM agents

Project description

WBAL

Weights & Biases Agent Library - A minimal framework for building LLM agents.

Overview

WBAL provides three core primitives:

  • Agent - Orchestrates the perceive-invoke-do loop
  • Environment - Provides tools and context
  • LM - Language model interface

All components inherit from WBALObject (Pydantic BaseModel + observe() method).

Quick Start

Requires OPENAI_API_KEY in your environment.

import weave
from wbal import Environment, OpenAIWBAgent, weaveTool, GPT5MiniTester

weave.init('my-project')

class MyEnv(Environment):
    env = "You are a helpful assistant."
    include_tools_in_observe = True

    @weaveTool
    def greet(self, name: str) -> str:
        """Greet someone by name."""
        return f"Hello, {name}!"

agent = OpenAIWBAgent(
    lm=GPT5MiniTester(),
    env=MyEnv(task="Say hello to Alice"),
    maxSteps=5,
    system_prompt="Use tools when helpful. Call exit() when you're done.",
)
agent.run()

Installation

From PyPI:

pip install wbal

From source (for local development):

git clone <this-repo>
cd wbal
uv sync

Documentation

Document Description
USER.md Usage guide, API reference, examples
DEVELOPER.md Architecture, contributing, testing
Agent_Instructions.md Agent/environment guidance

CLI

# Run (baseline, non-interactive)
wbal run --project my-project --task "Say hello to Alice, then call exit()"

# Chat (interactive via tool calls)
wbal chat --project my-project --task "Say hello to Alice"

# Poll (runs once or on an interval)
wbal poll --project my-project --task "Check status" --interval 300

# Run from a YAML agent manifest
wbal run --project my-project --agent-spec path/to/agent.yaml --task "Do the thing"

YAML Agents

WBAL supports YAML-based agent manifests that let you configure:

  • model + max steps
  • prompt files (YAML)
  • tool modules to attach to the agent/env
  • explicit subagent delegation (DAG) via run_agent

See examples/agents/README.md.

Agent Bundles (WandBSwarm-compatible)

WBAL can run “agent bundles” that expose run.sh (required) and install.sh (optional), with the same env var contract as WandBSwarm (AGENT_DIR, TASK_DIR, WORKSPACE, etc.).

wbal bundle validate --agent-dir path/to/agent
wbal bundle run --agent-dir path/to/agent --task-dir path/to/task --workspace-dir ./workspace

API

from wbal import (
    # Core
    Agent, Environment, StatefulEnvironment, LM,

    # Models
    GPT5Large, GPT5MiniTester,

    # Decorators
    weaveTool, tool,

    # Mixins
    ExitableAgent,

    # Helpers
    tool_timeout, format_openai_tool_response,
)

Examples

See examples/ for complete implementations.

  • examples/zagent_v1.py - Orchestrator-style agent with persistent notes + bash tool

Run locally:

uv run python examples/zagent_v1.py --task "Inspect this repo, take notes, then exit()"

Structure

wbal/
├── wbal/
│   ├── agent.py        # Agent class
│   ├── environment.py  # Environment, StatefulEnvironment
│   ├── lm.py           # LM, GPT5Large, GPT5MiniTester
│   ├── helper.py       # Tool decorators and utilities
│   └── mixins.py       # ExitableAgent
├── tests/
└── examples/

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

wbal-0.3.2.tar.gz (155.1 kB view details)

Uploaded Source

Built Distribution

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

wbal-0.3.2-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file wbal-0.3.2.tar.gz.

File metadata

  • Download URL: wbal-0.3.2.tar.gz
  • Upload date:
  • Size: 155.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for wbal-0.3.2.tar.gz
Algorithm Hash digest
SHA256 1e14bc42ecf0d4f460c20e0ab00a54659f869ef990a8af93ac6cf3fb71b20b5d
MD5 eebcecdf0e69f99c38db46da0e53b388
BLAKE2b-256 3db22b631e0dffc2a654f4f2c68ef56051a873f6ba341bf7aa81601024f7bbc5

See more details on using hashes here.

File details

Details for the file wbal-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: wbal-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for wbal-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4cf70fc05dc17104caef375d7ce6eca44e2338c29d3dfa0ad04769b864951159
MD5 c1eea68c046e57424a5f15da492522df
BLAKE2b-256 51b4b6f6f499caed01237bd5bfa664c95ec4df3dcb0741c3b202075f392a4983

See more details on using hashes here.

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