Skip to main content

AI coding agent with ReAct pattern and tool calling.

Project description

React Agent

An AI coding agent using the ReAct pattern (Reason-Act-Observe) with Claude and tool calling.

Install

pip install blocks-agent

Usage

from blocks_agent import AgentClient, AgentOptions

with AgentClient(AgentOptions(system_prompt="You are a helpful assistant.")) as client:
    response = client.send("What files are in the current directory?")
    print(response.text)

Async

import asyncio
from blocks_agent import AsyncAgentClient, AgentOptions

async def main():
    async with AsyncAgentClient(AgentOptions()) as client:
        response = await client.send("Summarize this project.")
        print(response.text)

asyncio.run(main())

Streaming

from blocks_agent import AgentClient, AgentOptions

with AgentClient(AgentOptions()) as client:
    for update in client.stream("List all Python files, then count them."):
        print(f"[turn] {update.text[:120]}...")
        print(f"       stop_reason={update.stop_reason}")

Configuration

AgentOptions(
    system_prompt="...",       # Custom system prompt
    model="claude-opus-4-6",   # Model to use
    max_turns=100,             # Max ReAct iterations
    cwd="/path/to/project",    # Working directory
    api_key="sk-...",          # Or set ANTHROPIC_API_KEY env var
    sandbox=True,              # Restrict file access to cwd
)

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

blocks_agent-0.1.0.tar.gz (22.7 kB view details)

Uploaded Source

File details

Details for the file blocks_agent-0.1.0.tar.gz.

File metadata

  • Download URL: blocks_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for blocks_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 384b93937814dd7686b9a39aa6d1f0afb47af84aed867527f80e08705c580460
MD5 03e56071508abc74cd71963e398b0bd6
BLAKE2b-256 0132d83385213d2e5528d4e8e190d41d2e81486c86cf7368e153b19b47e55b4e

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