Skip to Content
LangGraph

LangGraph

For Python LangGraph workflows, Blackbox uses the AgentIR LangGraph annotation library:

Install

Add the dependency to your Python project:

pip install agentir-langgraph

What You Annotate

Blackbox needs to know which functions correspond to LLM nodes and, when available, which state fields those nodes read or write.

Typical annotations include:

  • @llm_call(...) for an LLM node
  • @writes(...) for state written by that node

Example

from langgraph.graph import StateGraph from agentir_langgraph.decorators import llm_call, writes @writes("summary", "messages") @llm_call( model="claude-opus-4.7", reads=["messages"], static_vars=["SUMMARIZER_SYSTEM_PROMPT"], ) def summarizer(state, config=None): ... workflow = StateGraph(dict) workflow.add_node("summarizer", summarizer)

How Blackbox Uses It

Those annotations give Blackbox enough structure to compile:

  • the node identity
  • the model chosen for that node
  • parts of the state dependency graph
  • static prompt context that affects the request shape

That workflow structure is what lets Blackbox reason about routing decisions using the whole workflow instead of treating each call as an isolated request.

What The Annotation PR May Add

If you use the dashboard annotation flow instead of doing this manually, the PR may also:

  • add agentir-langgraph to requirements.txt or pyproject.toml
  • insert missing decorator imports
  • add GraphProxy imports or wrapping when needed for compile visibility
  • add managed compile files under .agentir/ and .github/workflows/

Runtime Requirement

Your application still needs to provide the Blackbox API key at runtime:

export BLACKBOX_API_KEY="bb_live_xxxxxxxxxxxxxxxx"

The key is sent on compile requests as api-key and on runtime /v1/chat/completions calls as Authorization: Bearer ....

Next Step

After your LangGraph workflow is annotated, return to Getting Started and route the compiled nodes through Blackbox.

Last updated on