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.5.tar.gz (155.2 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.5-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wbal-0.3.5.tar.gz
  • Upload date:
  • Size: 155.2 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.5.tar.gz
Algorithm Hash digest
SHA256 5db9a1c9c6d2139e3324a9ccd59a41e487910985968fd415ae0abecb09871b6c
MD5 759e0e86c711a8c9b35124881bc05b29
BLAKE2b-256 6c215305bd32e399599c718bca3c0981632090f6c9427e00495d6662d86fe5ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wbal-0.3.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 33b68edb84fba7a69ffac2c11ab47d9f99359e9125e240eca9bbd5598b305f42
MD5 c1d67c500caba891dcf4b92bb2d708df
BLAKE2b-256 73fff8f7f810b4ff1f2490bda198ddfe964e8b20d1da1960f03e658e4d14a70a

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