Skip to main content

Portable ReAct agent graph with MCP tools and RAG — part of the fractal-agent-graphs catalog

Project description

fractal-graph-react-agent

ReAct agent with MCP tools — part of the fractal-agents-runtime graph catalog.

Overview

This package provides a portable, self-contained ReAct agent graph built on LangGraph with:

  • MCP tool integration — connects to Model Context Protocol servers for extensible tool use
  • RAG tool factory — creates retrieval-augmented generation tools from document collections
  • OAuth token exchange — handles MCP server authentication with token caching
  • Multi-provider LLM support — OpenAI, Anthropic, Google, and custom OpenAI-compatible endpoints

Installation

uv add fractal-graph-react-agent

Usage

The graph is a portable factory function that accepts a RunnableConfig and optional persistence components via dependency injection:

from react_agent import graph
from langchain_core.runnables import RunnableConfig

# Build the agent graph — runtime injects persistence
config = RunnableConfig(configurable={"model_name": "openai:gpt-4o"})
agent = await graph(config, checkpointer=my_checkpointer, store=my_store)

# Invoke
result = await agent.ainvoke({"messages": [{"role": "user", "content": "Hello!"}]})

Dependency Injection

The graph() factory uses dependency injection for persistence — it never imports from any specific runtime:

# The runtime (e.g., Robyn server) creates and injects these:
from my_runtime.database import get_checkpointer, get_store

agent = await graph(
    config,
    checkpointer=get_checkpointer(),  # Thread-level conversation memory
    store=get_store(),                  # Cross-thread long-term memory
)

When checkpointer and store are None (the default), the agent runs without persistence — useful for testing or stateless invocations.

Configuration

The graph is configured via RunnableConfig.configurable:

Key Type Default Description
model_name str "openai:gpt-4o" LLM provider and model
temperature float 0.7 Sampling temperature
max_tokens int 4000 Maximum generation tokens
system_prompt str Generic helpful assistant System prompt
mcp_config dict None MCP server configuration
rag dict None RAG collection configuration
base_url str None Custom OpenAI-compatible endpoint

Architecture

This package is part of the 3-layer architecture:

apps/          → Thin HTTP wrappers (Robyn, FastAPI, etc.)
  ↓ depends on
graphs/        → Portable agent architectures (this package)
  ↓ depends on
infra/         → Shared runtime infrastructure (tracing, auth, store namespace)

Graphs have zero coupling to any runtime — they can be deployed to LangGraph Platform, embedded in any server framework, or run standalone.

License

MIT

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

fractal_graph_react_agent-0.0.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

fractal_graph_react_agent-0.0.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file fractal_graph_react_agent-0.0.0.tar.gz.

File metadata

File hashes

Hashes for fractal_graph_react_agent-0.0.0.tar.gz
Algorithm Hash digest
SHA256 cda8a8b42d09f23226fdaeba507e0927d86a6f5e3ac988a4ea0d1792ae969a16
MD5 9eeab7ac7616cfe9720f8b4d475c1841
BLAKE2b-256 c50c45d1ad9d4e49fa75c78d21ac0b7e4ee65bf7a0c749d195aaf1c1d6093be7

See more details on using hashes here.

Provenance

The following attestation bundles were made for fractal_graph_react_agent-0.0.0.tar.gz:

Publisher: release.yml on l4b4r4b4b4/fractal-agents-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fractal_graph_react_agent-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fractal_graph_react_agent-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4621b2b0878a160fe32320e764011e2d2a74e8e9b1c43895e09169c6d1938744
MD5 23891a0ae63cff82599690effd0bd8cf
BLAKE2b-256 f60b3df70a18d020af0ca432ad710f5a8cb5d677844b61f4cbf73ab40b794151

See more details on using hashes here.

Provenance

The following attestation bundles were made for fractal_graph_react_agent-0.0.0-py3-none-any.whl:

Publisher: release.yml on l4b4r4b4b4/fractal-agents-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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