Metadata-Version: 2.5
Name: baiam-agents-builder
Version: 0.1.0
Summary: Typed agent primitives and tracing for Baiam Agent
Requires-Python: <3.13,>=3.12
Requires-Dist: arize-phoenix-client<3.0.0,>=2.6.0
Requires-Dist: arize-phoenix-otel==0.13.1
Requires-Dist: langchain-core<2.0.0,>=1.8.4
Requires-Dist: langchain-mcp-adapters<0.4.0,>=0.3.2
Requires-Dist: langchain-ollama<2.0.0,>=1.1.0
Requires-Dist: langchain-openrouter<0.4.0,>=0.3.0
Requires-Dist: langgraph<1.3.0,>=1.2.24
Requires-Dist: opentelemetry-api<2.0.0,>=1.37.0
Requires-Dist: pydantic-settings<3.0.0,>=2.12.0
Requires-Dist: pydantic<3.0.0,>=2.12.5
Requires-Dist: pyyaml<7.0.0,>=6.0.2
Description-Content-Type: text/markdown

# baiam-agents-builder

Typed agent primitives and tracing for Baiam Agent. Distribution name:
`baiam-agents-builder`; Python import namespace: `agents_builder`.

This is a separate project starting at version `0.1.0`, with a fresh Git history.
It retains the code needed by the current Baiam Agent checkout, plus the MCP and
Ollama features retained explicitly for future use.

## Included API

- `Agent`: configuration, cached LLM factory, lazy graph construction,
  `load_tool()` with MCP caching, and `push()` to save a graph image.
- `Prompt`, `Node`, `RouterNode`, and `LLMNode`: primitives for Baiam's own nodes.
- `LLM`, `LLMFactory`, `OpenRouterLLM`, and `OllamaLLM`, with validated settings.
- `FromConfigMixin`: `from_config()`, `from_kwargs()`, and `get_config_class()`.
- `TraceAnnotator` and `PhoenixTraceAnnotator`, including Git revision labels.

The old retrieval nodes/states, deletion strategies, message/context helpers,
agent/node evaluation frameworks, and unused type aliases are excluded.
Baiam keeps its own evaluation runners, assertions, and trajectories.

The package uses `langchain-core` directly. OpenEvals belongs to Baiam's own
evaluation code and is not a runtime dependency here.

## Use from Baiam Agent

In the sibling `baiam-agent` checkout:

```sh
uv remove agents-builder
uv add --editable ../baiam-agents-builder
uv add 'openevals>=0.2.0,<1.0.0'
make ci
```

Existing `agents_builder` imports and YAML module paths remain valid. Replace the
old distribution rather than installing both: they provide the same Python
namespace. For deployment, publish this distribution and replace the local path
with a version constraint on `baiam-agents-builder`.

Configuration precedence remains explicit constructor values, YAML at
`/config/config.yaml`, environment variables, dotenv, then secrets. Baiam also
provides its own YAML loading through `load_component()` and agent settings.

## Development

Requires Python 3.12 and [uv](https://docs.astral.sh/uv/).

```sh
uv lock
make dev-install
make ci
```

Use `make help` to list the available development commands.

`make ci` checks lint and formatting, types, security, tests with at least 95%
branch-aware coverage, and both source and wheel builds. Tests cover graph
execution, MCP caching, configuration, provider construction, and tracing. They
do not contact live Ollama, OpenRouter, MCP, or Phoenix services.

## CI and publishing

The GitLab pipeline uses the same Makefile targets as local development. It runs
for merge requests, the default branch, and protected tags. Set the GitLab
default branch to `dev` when connecting this repository. Codecov upload runs only
when `CODECOV_TOKEN` is configured.

Publishing is manual; CI builds artifacts without publishing a release. After
confirming that the distribution name is available on PyPI and the token account
can publish it, run:

```sh
read -rsp 'PyPI token: ' UV_PUBLISH_TOKEN
echo
export UV_PUBLISH_TOKEN
./scripts/publish.sh 0.1.1
unset UV_PUBLISH_TOKEN
```

The script updates the version in `pyproject.toml` and `uv.lock`, builds into
`dist/<version>/`, and publishes only that version's wheel and source distribution.
Run `make ci` before publishing, then commit the version files after a successful
release.

This reduced package is derived from the local `agents-builder` codebase. The
original project and the Baiam Agent checkout are not modified by its creation.
