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
)
Metadata
Release files for blocks-agent 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blocks_agent-0.1.0.tar.gz | 22.7 kB | Details |
Release files / blocks_agent-0.1.0.tar.gz
| Download URL | blocks_agent-0.1.0.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
384b93937814dd7686b9a39aa6d1f0afb47af84aed867527f80e08705c580460
|
|
BLAKE2b-256 checksum How to use checksums |
0132d83385213d2e5528d4e8e190d41d2e81486c86cf7368e153b19b47e55b4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|