AbstractAgent 0.1.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. {abstractagent-0.1.0 → abstractagent-0.3.0}/LICENSE +5 -1
  2. abstractagent-0.3.0/PKG-INFO +133 -0
  3. abstractagent-0.3.0/README.md +120 -0
  4. abstractagent-0.3.0/pyproject.toml +25 -0
  5. abstractagent-0.3.0/src/abstractagent/__init__.py +49 -0
  6. abstractagent-0.3.0/src/abstractagent/adapters/__init__.py +7 -0
  7. abstractagent-0.3.0/src/abstractagent/adapters/codeact_runtime.py +1163 -0
  8. abstractagent-0.3.0/src/abstractagent/adapters/memact_runtime.py +721 -0
  9. abstractagent-0.3.0/src/abstractagent/adapters/react_runtime.py +1437 -0
  10. abstractagent-0.3.0/src/abstractagent/agents/__init__.py +19 -0
  11. abstractagent-0.3.0/src/abstractagent/agents/base.py +478 -0
  12. abstractagent-0.3.0/src/abstractagent/agents/codeact.py +265 -0
  13. abstractagent-0.3.0/src/abstractagent/agents/memact.py +244 -0
  14. abstractagent-0.3.0/src/abstractagent/agents/react.py +283 -0
  15. abstractagent-0.3.0/src/abstractagent/logic/__init__.py +21 -0
  16. abstractagent-0.3.0/src/abstractagent/logic/builtins.py +236 -0
  17. abstractagent-0.3.0/src/abstractagent/logic/codeact.py +173 -0
  18. abstractagent-0.3.0/src/abstractagent/logic/memact.py +127 -0
  19. abstractagent-0.3.0/src/abstractagent/logic/react.py +186 -0
  20. abstractagent-0.3.0/src/abstractagent/logic/types.py +30 -0
  21. abstractagent-0.3.0/src/abstractagent/repl.py +34 -0
  22. abstractagent-0.3.0/src/abstractagent/sandbox/__init__.py +7 -0
  23. abstractagent-0.3.0/src/abstractagent/sandbox/interface.py +22 -0
  24. abstractagent-0.3.0/src/abstractagent/sandbox/local.py +68 -0
  25. abstractagent-0.3.0/src/abstractagent/scripts/__init__.py +5 -0
  26. abstractagent-0.3.0/src/abstractagent/scripts/lmstudio_tool_eval.py +426 -0
  27. abstractagent-0.3.0/src/abstractagent/tools/__init__.py +61 -0
  28. abstractagent-0.3.0/src/abstractagent/tools/code_execution.py +45 -0
  29. abstractagent-0.3.0/src/abstractagent/tools/self_improve.py +56 -0
  30. abstractagent-0.3.0/src/abstractagent.egg-info/PKG-INFO +133 -0
  31. abstractagent-0.3.0/src/abstractagent.egg-info/SOURCES.txt +54 -0
  32. abstractagent-0.3.0/src/abstractagent.egg-info/entry_points.txt +2 -0
  33. abstractagent-0.3.0/src/abstractagent.egg-info/requires.txt +5 -0
  34. abstractagent-0.3.0/tests/test_active_context_policy_adoption.py +95 -0
  35. abstractagent-0.3.0/tests/test_agent_plan_review_modes.py +140 -0
  36. abstractagent-0.3.0/tests/test_agents_integration_llm.py +366 -0
  37. abstractagent-0.3.0/tests/test_base_agent_trace_accessors.py +76 -0
  38. abstractagent-0.3.0/tests/test_builtin_tool_specs_optional_defaults.py +22 -0
  39. abstractagent-0.3.0/tests/test_codeact_logic.py +44 -0
  40. abstractagent-0.3.0/tests/test_codeact_runtime_verifier_policy.py +49 -0
  41. abstractagent-0.3.0/tests/test_memact_session_memory.py +25 -0
  42. abstractagent-0.3.0/tests/test_memact_workflow.py +93 -0
  43. abstractagent-0.3.0/tests/test_memory_recall_tool.py +336 -0
  44. abstractagent-0.3.0/tests/test_prompt_deobservation.py +95 -0
  45. abstractagent-0.3.0/tests/test_react_logic.py +85 -0
  46. abstractagent-0.3.0/tests/test_react_runtime_parse_sanitizes_observation_transcripts.py +66 -0
  47. abstractagent-0.3.0/tests/test_react_runtime_tool_loop_guard.py +148 -0
  48. abstractagent-0.3.0/tests/test_react_runtime_verifier_policy.py +97 -0
  49. abstractagent-0.3.0/tests/test_react_workflow_system_prompt_and_tools_override.py +134 -0
  50. abstractagent-0.3.0/tests/test_run_start_seeds_runtime_provider_model.py +49 -0
  51. abstractagent-0.3.0/tests/test_session_memory.py +32 -0
  52. abstractagent-0.3.0/tests/test_toolcall_queue_and_review_prompt.py +289 -0
  53. abstractagent-0.3.0/tests/test_tools_editing.py +80 -0
  54. abstractagent-0.1.0/MANIFEST.in +0 -6
  55. abstractagent-0.1.0/PKG-INFO +0 -103
  56. abstractagent-0.1.0/README.md +0 -69
  57. abstractagent-0.1.0/pyproject.toml +0 -67
  58. abstractagent-0.1.0/src/AbstractAgent.egg-info/PKG-INFO +0 -103
  59. abstractagent-0.1.0/src/AbstractAgent.egg-info/SOURCES.txt +0 -10
  60. abstractagent-0.1.0/src/AbstractAgent.egg-info/requires.txt +0 -7
  61. abstractagent-0.1.0/src/abstractagent/__init__.py +0 -56
  62. {abstractagent-0.1.0 → abstractagent-0.3.0}/setup.cfg +0 -0
  63. {abstractagent-0.1.0/src/AbstractAgent.egg-info → abstractagent-0.3.0/src/abstractagent.egg-info}/dependency_links.txt +0 -0
  64. {abstractagent-0.1.0/src/AbstractAgent.egg-info → abstractagent-0.3.0/src/abstractagent.egg-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 AbstractAgent Team
3
+ Copyright (c) 2025 Laurent-Philippe Albou
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+
24
+
25
+
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: abstractagent
3
+ Version: 0.3.0
4
+ Summary: Agent implementations using AbstractRuntime and AbstractCore
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: abstractcore[tools]
9
+ Requires-Dist: abstractruntime
10
+ Provides-Extra: dev
11
+ Requires-Dist: pytest>=7.0; extra == "dev"
12
+ Dynamic: license-file
13
+
14
+ # AbstractAgent
15
+
16
+ Agent implementations using AbstractRuntime and AbstractCore.
17
+
18
+ ## Features
19
+
20
+ - **ReAct Agent**: Reason-Act-Observe loop with tool calling
21
+ - **Host UX in AbstractCode**: the interactive terminal shell lives in **AbstractCode**; AbstractAgent stays focused on agent patterns/workflows
22
+ - **Pause/Resume**: Durable agent state with interrupt/resume capability
23
+ - **Ask User**: Agent can ask questions with multiple choice + free text
24
+ - **Ledger Recording**: All tool calls recorded for auditability
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install -e .
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ### Simple (Factory)
35
+
36
+ ```python
37
+ from abstractagent import create_react_agent
38
+
39
+ # One-liner agent creation
40
+ agent = create_react_agent()
41
+ agent.start("List the files in the current directory")
42
+ state = agent.run_to_completion()
43
+ print(state.output["answer"])
44
+ ```
45
+
46
+ ### With Custom Tools
47
+
48
+ ```python
49
+ from abstractagent import create_react_agent
50
+ from abstractcore.tools import tool
51
+
52
+ @tool(name="my_tool", description="My custom tool")
53
+ def my_tool(query: str) -> str:
54
+ """My custom tool."""
55
+ return f"Result for {query}"
56
+
57
+ agent = create_react_agent(tools=[my_tool])
58
+ ```
59
+
60
+ ### Full Control
61
+
62
+ ```python
63
+ from abstractruntime.integrations.abstractcore import create_local_runtime
64
+ from abstractagent import ReactAgent, list_files, read_file
65
+
66
+ # Create runtime
67
+ runtime = create_local_runtime(
68
+ provider="ollama",
69
+ model="qwen3:4b-instruct-2507-q4_K_M",
70
+ )
71
+
72
+ # Create agent with specific tools
73
+ agent = ReactAgent(
74
+ runtime=runtime,
75
+ tools=[list_files, read_file],
76
+ )
77
+
78
+ agent.start("List the files in the current directory")
79
+ state = agent.run_to_completion()
80
+ print(state.output["answer"])
81
+ ```
82
+
83
+ ## State Persistence
84
+
85
+ Resume agents across process restarts:
86
+
87
+ ```python
88
+ agent = create_react_agent()
89
+ agent.start("Long running task")
90
+
91
+ # Save state before exit
92
+ agent.save_state("agent_state.json")
93
+
94
+ # ... process restarts ...
95
+
96
+ # Load and resume
97
+ agent = create_react_agent()
98
+ agent.load_state("agent_state.json")
99
+ state = agent.run_to_completion()
100
+
101
+ # Cleanup
102
+ agent.clear_state("agent_state.json")
103
+ ```
104
+
105
+ ## Interactive Shell (AbstractCode)
106
+
107
+ ```bash
108
+ # The interactive REPL moved to AbstractCode (host UX).
109
+ abstractcode --agent react --provider ollama --model qwen3:4b-instruct-2507-q4_K_M
110
+ ```
111
+
112
+ ## Architecture
113
+
114
+ ```
115
+ AbstractAgent
116
+ │
117
+ ├── Uses AbstractRuntime for durable execution
118
+ │ - Workflows survive crashes
119
+ │ - Pause/resume capability
120
+ │ - Ledger tracks all actions (LLM calls, tool calls)
121
+ │
122
+ └── Uses AbstractCore for LLM/tools
123
+ - Provider-agnostic LLM calls
124
+ - Tool registration and execution
125
+ - Tool call parsing for all model architectures
126
+ ```
127
+
128
+ ## Available Tools
129
+
130
+ - Default tool callables are re-exported from AbstractCore in `abstractagent.tools` (file ops, web tools, `execute_command`), plus:
131
+ - `execute_python(code, timeout_s=...)`
132
+ - `self_improve(suggestion, ...)`
133
+ - 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).
@@ -0,0 +1,120 @@
1
+ # AbstractAgent
2
+
3
+ Agent implementations using AbstractRuntime and AbstractCore.
4
+
5
+ ## Features
6
+
7
+ - **ReAct Agent**: Reason-Act-Observe loop with tool calling
8
+ - **Host UX in AbstractCode**: the interactive terminal shell lives in **AbstractCode**; AbstractAgent stays focused on agent patterns/workflows
9
+ - **Pause/Resume**: Durable agent state with interrupt/resume capability
10
+ - **Ask User**: Agent can ask questions with multiple choice + free text
11
+ - **Ledger Recording**: All tool calls recorded for auditability
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install -e .
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ### Simple (Factory)
22
+
23
+ ```python
24
+ from abstractagent import create_react_agent
25
+
26
+ # One-liner agent creation
27
+ agent = create_react_agent()
28
+ agent.start("List the files in the current directory")
29
+ state = agent.run_to_completion()
30
+ print(state.output["answer"])
31
+ ```
32
+
33
+ ### With Custom Tools
34
+
35
+ ```python
36
+ from abstractagent import create_react_agent
37
+ from abstractcore.tools import tool
38
+
39
+ @tool(name="my_tool", description="My custom tool")
40
+ def my_tool(query: str) -> str:
41
+ """My custom tool."""
42
+ return f"Result for {query}"
43
+
44
+ agent = create_react_agent(tools=[my_tool])
45
+ ```
46
+
47
+ ### Full Control
48
+
49
+ ```python
50
+ from abstractruntime.integrations.abstractcore import create_local_runtime
51
+ from abstractagent import ReactAgent, list_files, read_file
52
+
53
+ # Create runtime
54
+ runtime = create_local_runtime(
55
+ provider="ollama",
56
+ model="qwen3:4b-instruct-2507-q4_K_M",
57
+ )
58
+
59
+ # Create agent with specific tools
60
+ agent = ReactAgent(
61
+ runtime=runtime,
62
+ tools=[list_files, read_file],
63
+ )
64
+
65
+ agent.start("List the files in the current directory")
66
+ state = agent.run_to_completion()
67
+ print(state.output["answer"])
68
+ ```
69
+
70
+ ## State Persistence
71
+
72
+ Resume agents across process restarts:
73
+
74
+ ```python
75
+ agent = create_react_agent()
76
+ agent.start("Long running task")
77
+
78
+ # Save state before exit
79
+ agent.save_state("agent_state.json")
80
+
81
+ # ... process restarts ...
82
+
83
+ # Load and resume
84
+ agent = create_react_agent()
85
+ agent.load_state("agent_state.json")
86
+ state = agent.run_to_completion()
87
+
88
+ # Cleanup
89
+ agent.clear_state("agent_state.json")
90
+ ```
91
+
92
+ ## Interactive Shell (AbstractCode)
93
+
94
+ ```bash
95
+ # The interactive REPL moved to AbstractCode (host UX).
96
+ abstractcode --agent react --provider ollama --model qwen3:4b-instruct-2507-q4_K_M
97
+ ```
98
+
99
+ ## Architecture
100
+
101
+ ```
102
+ AbstractAgent
103
+ │
104
+ ├── Uses AbstractRuntime for durable execution
105
+ │ - Workflows survive crashes
106
+ │ - Pause/resume capability
107
+ │ - Ledger tracks all actions (LLM calls, tool calls)
108
+ │
109
+ └── Uses AbstractCore for LLM/tools
110
+ - Provider-agnostic LLM calls
111
+ - Tool registration and execution
112
+ - Tool call parsing for all model architectures
113
+ ```
114
+
115
+ ## Available Tools
116
+
117
+ - Default tool callables are re-exported from AbstractCore in `abstractagent.tools` (file ops, web tools, `execute_command`), plus:
118
+ - `execute_python(code, timeout_s=...)`
119
+ - `self_improve(suggestion, ...)`
120
+ - 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).
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "abstractagent"
7
+ version = "0.3.0"
8
+ description = "Agent implementations using AbstractRuntime and AbstractCore"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "abstractcore[tools]",
13
+ "abstractruntime",
14
+ ]
15
+
16
+ [project.optional-dependencies]
17
+ dev = [
18
+ "pytest>=7.0",
19
+ ]
20
+
21
+ [tool.setuptools.packages.find]
22
+ where = ["src"]
23
+
24
+ [project.scripts]
25
+ react-agent = "abstractagent.repl:main"
@@ -0,0 +1,49 @@
1
+ """AbstractAgent - Agent implementations using AbstractRuntime and AbstractCore."""
2
+
3
+ from .agents import (
4
+ BaseAgent,
5
+ ReactAgent,
6
+ create_react_workflow,
7
+ create_react_agent,
8
+ CodeActAgent,
9
+ create_codeact_workflow,
10
+ create_codeact_agent,
11
+ )
12
+ from .tools import (
13
+ ALL_TOOLS,
14
+ list_files,
15
+ read_file,
16
+ search_files,
17
+ execute_command,
18
+ write_file,
19
+ edit_file,
20
+ web_search,
21
+ fetch_url,
22
+ execute_python,
23
+ self_improve,
24
+ )
25
+
26
+ __all__ = [
27
+ # Base class for custom agents
28
+ "BaseAgent",
29
+ # ReAct agent
30
+ "ReactAgent",
31
+ "create_react_workflow",
32
+ "create_react_agent",
33
+ # CodeAct agent
34
+ "CodeActAgent",
35
+ "create_codeact_workflow",
36
+ "create_codeact_agent",
37
+ # Tools
38
+ "ALL_TOOLS",
39
+ "list_files",
40
+ "read_file",
41
+ "search_files",
42
+ "execute_command",
43
+ "write_file",
44
+ "edit_file",
45
+ "web_search",
46
+ "fetch_url",
47
+ "execute_python",
48
+ "self_improve",
49
+ ]
@@ -0,0 +1,7 @@
1
+ """Runtime adapters for agent logic."""
2
+
3
+ from .codeact_runtime import create_codeact_workflow
4
+ from .react_runtime import create_react_workflow
5
+ from .memact_runtime import create_memact_workflow
6
+
7
+ __all__ = ["create_react_workflow", "create_codeact_workflow", "create_memact_workflow"]