Agent implementations using AbstractRuntime and AbstractCore
Project description
AbstractAgent
Agent implementations using AbstractRuntime and AbstractCore.
Features
- ReAct Agent: Reason-Act-Observe loop with tool calling
- Async REPL: Interactive agent with real-time step visibility
- Pause/Resume: Durable agent state with interrupt/resume capability
- Ask User: Agent can ask questions with multiple choice + free text
- Ledger Recording: All tool calls recorded for auditability
Installation
pip install -e .
Quick Start
Simple (Factory)
from abstractagent import create_react_agent
# One-liner agent creation
agent = create_react_agent()
agent.start("List the files in the current directory")
state = agent.run_to_completion()
print(state.output["answer"])
With Custom Tools
from abstractagent import create_react_agent
from abstractcore.tools import tool
@tool(name="my_tool", description="My custom tool")
def my_tool(query: str) -> str:
"""My custom tool."""
return f"Result for {query}"
agent = create_react_agent(tools=[my_tool])
Full Control
from abstractruntime.integrations.abstractcore import create_local_runtime
from abstractagent import ReactAgent, list_files, read_file
# Create runtime
runtime = create_local_runtime(
provider="ollama",
model="qwen3:4b-instruct-2507-q4_K_M",
)
# Create agent with specific tools
agent = ReactAgent(
runtime=runtime,
tools=[list_files, read_file],
)
agent.start("List the files in the current directory")
state = agent.run_to_completion()
print(state.output["answer"])
State Persistence
Resume agents across process restarts:
agent = create_react_agent()
agent.start("Long running task")
# Save state before exit
agent.save_state("agent_state.json")
# ... process restarts ...
# Load and resume
agent = create_react_agent()
agent.load_state("agent_state.json")
state = agent.run_to_completion()
# Cleanup
agent.clear_state("agent_state.json")
REPL Usage
# Start the ReAct agent REPL
python -m abstractagent.repl --provider ollama --model qwen3:4b-instruct-2507-q4_K_M
Architecture
AbstractAgent
│
├── Uses AbstractRuntime for durable execution
│ - Workflows survive crashes
│ - Pause/resume capability
│ - Ledger tracks all actions (LLM calls, tool calls)
│
└── Uses AbstractCore for LLM/tools
- Provider-agnostic LLM calls
- Tool registration and execution
- Tool call parsing for all model architectures
Available Tools
list_files(path)- List files and directoriesread_file(path)- Read file contentssearch_files(pattern, path)- Search for files matching a glob patternexecute_command(command)- Execute a shell command (with safety restrictions)ask_user(question, choices)- Ask the user a question (built-in)
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
abstractagent-0.2.0.tar.gz
(26.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file abstractagent-0.2.0.tar.gz.
File metadata
- Download URL: abstractagent-0.2.0.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa61e6eee1f220c6606b8fddf7ca8afc215eee2a3e074d9f64fe01bf35ec6bf8
|
|
| MD5 |
770895594cedd301c9096c973490c93c
|
|
| BLAKE2b-256 |
905e9cc362b7904b939efd398aba887e9ca89496341bfdfe2abb0198243c25e0
|
File details
Details for the file abstractagent-0.2.0-py3-none-any.whl.
File metadata
- Download URL: abstractagent-0.2.0-py3-none-any.whl
- Upload date:
- Size: 36.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4d55341b4a350257e722c742a200fb6490c99d042e541cb248785a9a3be6d40
|
|
| MD5 |
77a0cfb6fa21b8383325686d502b7c40
|
|
| BLAKE2b-256 |
d7cdc5470c0cabd1452eff7dc792e3a75f90569e36e0f8b6e9273bcff7c03b58
|