Skip to main content

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
  • Host UX in AbstractCode: the interactive terminal shell lives in AbstractCode; AbstractAgent stays focused on agent patterns/workflows
  • 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")

Interactive Shell (AbstractCode)

# The interactive REPL moved to AbstractCode (host UX).
abstractcode --agent react --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

  • Default tool callables are re-exported from AbstractCore in abstractagent.tools (file ops, web tools, execute_command), plus:
    • execute_python(code, timeout_s=...)
    • self_improve(suggestion, ...)
  • The agent also exposes schema-only built-ins (ask_user, recall_memory, inspect_vars, remember, compact_memory) which are translated into Runtime effects by the workflow adapters (durable; no callable persistence).

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.3.0.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

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

abstractagent-0.3.0-py3-none-any.whl (69.5 kB view details)

Uploaded Python 3

File details

Details for the file abstractagent-0.3.0.tar.gz.

File metadata

  • Download URL: abstractagent-0.3.0.tar.gz
  • Upload date:
  • Size: 67.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for abstractagent-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d80e7a8829e6b107d407d0c6510b2060f431cc2ebcd8533fea5a832b1ca58108
MD5 cfe3819f89cedc5f83e3ef9d8319cc33
BLAKE2b-256 2ecf8d73cb5aa3413c85d8c577116f419c38014097dabfe64087dd492d7982c9

See more details on using hashes here.

File details

Details for the file abstractagent-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: abstractagent-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 69.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for abstractagent-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b21c6ecea9aee8e40f345151de68ba705d94681cc3b0ad54b56f2990f88b265a
MD5 21cd74458ec1fbe4c15fc7a357c42494
BLAKE2b-256 bc3728c60df1c07b70e1f418d71978b4a8e42c241f8feeadb3cbf1380da0587e

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