makefile-agent 0.3.3__tar.gz → 0.4.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 (76) hide show
  1. makefile_agent-0.4.0/PKG-INFO +178 -0
  2. makefile_agent-0.4.0/README.md +152 -0
  3. makefile_agent-0.4.0/make_agent/agent_core/__init__.py +104 -0
  4. makefile_agent-0.4.0/make_agent/agent_core/agent.py +388 -0
  5. makefile_agent-0.4.0/make_agent/agent_core/bridge.py +166 -0
  6. makefile_agent-0.4.0/make_agent/agent_core/constants.py +16 -0
  7. makefile_agent-0.4.0/make_agent/agent_core/events.py +94 -0
  8. makefile_agent-0.3.3/make_agent/commands.py → makefile_agent-0.4.0/make_agent/agent_core/export.py +23 -4
  9. makefile_agent-0.4.0/make_agent/agent_core/loop.py +654 -0
  10. makefile_agent-0.4.0/make_agent/agent_core/middleware.py +78 -0
  11. makefile_agent-0.4.0/make_agent/agent_core/provider.py +21 -0
  12. makefile_agent-0.4.0/make_agent/agent_shell/__init__.py +4 -0
  13. makefile_agent-0.4.0/make_agent/agent_shell/run.py +81 -0
  14. makefile_agent-0.4.0/make_agent/agent_shell/shell.py +872 -0
  15. makefile_agent-0.4.0/make_agent/app_dirs.py +80 -0
  16. makefile_agent-0.4.0/make_agent/builtin_tools/__init__.py +30 -0
  17. makefile_agent-0.4.0/make_agent/builtin_tools/file_tools.py +131 -0
  18. makefile_agent-0.4.0/make_agent/builtin_tools/skill_tools.py +397 -0
  19. makefile_agent-0.4.0/make_agent/main.py +275 -0
  20. makefile_agent-0.4.0/make_agent/memory/__init__.py +4 -0
  21. {makefile_agent-0.3.3/make_agent → makefile_agent-0.4.0/make_agent/memory}/memory.py +77 -9
  22. makefile_agent-0.3.3/make_agent/builtin_tools/memory_tools.py → makefile_agent-0.4.0/make_agent/memory/tools.py +16 -4
  23. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/make_agent/parser.py +30 -12
  24. makefile_agent-0.4.0/make_agent/protocols.py +55 -0
  25. makefile_agent-0.4.0/make_agent/provider/__init__.py +61 -0
  26. makefile_agent-0.4.0/make_agent/provider/anthropic.py +231 -0
  27. makefile_agent-0.4.0/make_agent/provider/base.py +80 -0
  28. makefile_agent-0.4.0/make_agent/provider/openai.py +133 -0
  29. makefile_agent-0.4.0/make_agent/skill_backend.py +94 -0
  30. makefile_agent-0.4.0/make_agent/templates/makefile/SYSTEM.md +51 -0
  31. makefile_agent-0.4.0/make_agent/tool_display.py +152 -0
  32. makefile_agent-0.4.0/make_agent/tool_handler/__init__.py +10 -0
  33. makefile_agent-0.4.0/make_agent/tool_handler/handler.py +107 -0
  34. makefile_agent-0.3.3/make_agent/tools.py → makefile_agent-0.4.0/make_agent/tool_handler/runner.py +88 -58
  35. makefile_agent-0.4.0/makefile_agent.egg-info/PKG-INFO +178 -0
  36. makefile_agent-0.4.0/makefile_agent.egg-info/SOURCES.txt +55 -0
  37. makefile_agent-0.4.0/makefile_agent.egg-info/requires.txt +3 -0
  38. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/pyproject.toml +9 -5
  39. makefile_agent-0.4.0/tests/test_agent.py +480 -0
  40. makefile_agent-0.4.0/tests/test_agent_shell.py +65 -0
  41. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/tests/test_app_dirs.py +37 -3
  42. makefile_agent-0.4.0/tests/test_bridge.py +433 -0
  43. makefile_agent-0.4.0/tests/test_builtin_tools.py +402 -0
  44. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/tests/test_commands.py +1 -1
  45. makefile_agent-0.4.0/tests/test_compact.py +478 -0
  46. makefile_agent-0.4.0/tests/test_main.py +254 -0
  47. makefile_agent-0.4.0/tests/test_memory.py +970 -0
  48. makefile_agent-0.4.0/tests/test_middleware.py +447 -0
  49. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/tests/test_tools.py +66 -33
  50. makefile_agent-0.4.0/tests/test_trusted_skill.py +262 -0
  51. makefile_agent-0.3.3/PKG-INFO +0 -293
  52. makefile_agent-0.3.3/README.md +0 -268
  53. makefile_agent-0.3.3/make_agent/agent.py +0 -422
  54. makefile_agent-0.3.3/make_agent/agent_shell.py +0 -143
  55. makefile_agent-0.3.3/make_agent/app_dirs.py +0 -51
  56. makefile_agent-0.3.3/make_agent/builtin_tools/__init__.py +0 -79
  57. makefile_agent-0.3.3/make_agent/builtin_tools/agent_tools.py +0 -219
  58. makefile_agent-0.3.3/make_agent/main.py +0 -211
  59. makefile_agent-0.3.3/make_agent/settings.py +0 -93
  60. makefile_agent-0.3.3/make_agent/templates/orchestra.mk +0 -71
  61. makefile_agent-0.3.3/makefile_agent.egg-info/PKG-INFO +0 -293
  62. makefile_agent-0.3.3/makefile_agent.egg-info/SOURCES.txt +0 -33
  63. makefile_agent-0.3.3/makefile_agent.egg-info/requires.txt +0 -2
  64. makefile_agent-0.3.3/tests/test_agent.py +0 -338
  65. makefile_agent-0.3.3/tests/test_builtin_tools.py +0 -320
  66. makefile_agent-0.3.3/tests/test_e2e_smoke.py +0 -37
  67. makefile_agent-0.3.3/tests/test_main.py +0 -74
  68. makefile_agent-0.3.3/tests/test_memory.py +0 -689
  69. makefile_agent-0.3.3/tests/test_settings.py +0 -281
  70. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/LICENSE +0 -0
  71. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/make_agent/__init__.py +0 -0
  72. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/makefile_agent.egg-info/dependency_links.txt +0 -0
  73. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/makefile_agent.egg-info/entry_points.txt +0 -0
  74. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/makefile_agent.egg-info/top_level.txt +0 -0
  75. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/setup.cfg +0 -0
  76. {makefile_agent-0.3.3 → makefile_agent-0.4.0}/tests/test_parser.py +0 -0
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.4
2
+ Name: makefile-agent
3
+ Version: 0.4.0
4
+ Summary: An AI agent powered by Makefile skills.
5
+ Author: Dmitriy Sorochenkov
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/dmtr/make-agent
8
+ Project-URL: Repository, https://github.com/dmtr/make-agent
9
+ Project-URL: Issues, https://github.com/dmtr/make-agent/issues
10
+ Keywords: ai,agent,makefile,llm,automation
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: anthropic>=0.105.2
23
+ Requires-Dist: openai>=1.0
24
+ Requires-Dist: prompt-toolkit==3.0.52
25
+ Dynamic: license-file
26
+
27
+ # make-agent
28
+
29
+ An AI agent powered by Makefile skills. Skills extend the agent with domain-specific instructions and shell tools.
30
+
31
+ ## Installation
32
+
33
+ ```
34
+ pip install makefile-agent
35
+ ```
36
+
37
+ Requires Python 3.11+ and a working `make` binary. Uses Anthropic and OpenAI SDKs for model access — set the appropriate provider API key in your environment (for example `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`).
38
+
39
+ ## Usage
40
+
41
+ ```
42
+ make_agent [run] --model MODEL [--prompt PROMPT | --prompt-file FILE]
43
+ ```
44
+
45
+ | Flag | Default | Description |
46
+ |---|---|---|
47
+ | `--model MODEL` | — (required) | Model string (e.g. `claude-opus-4-5`, `gpt-4o`) |
48
+ | `--skills-dir DIR` | `~/.make-agent/<project>/makefile/skills/` | Directory containing skills |
49
+ | `--system PROMPT` | — | System prompt string (overrides SYSTEM.md discovery) |
50
+ | `--system-file FILE` | — | Read system prompt from FILE (overrides SYSTEM.md discovery) |
51
+ | `--prompt PROMPT` | — | Send a single prompt and exit (non-interactive) |
52
+ | `--prompt-file FILE` | — | Read a single prompt from FILE and exit |
53
+ | `--disable-builtin-tools TOOLS` | — | Comma-separated built-in tool names to disable, or `all` |
54
+ | `--trusted-skills SKILLS` | — | Comma-separated trusted skills or `all`; trusted skills run without confirmation |
55
+ | `--max-tool-output CHARS` | 32000 | Truncate tool output; `0` = unlimited |
56
+ | `--max-tokens N` | 4096 | Max tokens in the model response |
57
+ | `--reasoning-effort EFFORT` | `medium` | `none\|minimal\|low\|medium\|high\|xhigh` |
58
+ | `--prompt-cache` | disabled | Enable Anthropic system-prompt caching |
59
+ | `--compact-mode MODE` | `drop` | Context compaction strategy when context window is exceeded: `drop` removes oldest turns; `summarize` replaces turns with LLM-generated summaries |
60
+ | `--max-retries N` | 5 | Max retries on rate-limit errors |
61
+ | `--tool-timeout SECONDS` | 600 | Timeout per tool call |
62
+ | `--loglevel LEVEL` | `INFO` | `DEBUG\|INFO\|WARNING\|ERROR\|CRITICAL` |
63
+
64
+ Without `--prompt`, the agent starts an interactive full-screen REPL. Press Ctrl-D, `/exit`, or `/quit` to leave.
65
+
66
+ Interactive commands: `/help`, `/export` (save conversation to HTML), `/stats` (token usage totals), `/exit`, `/quit`.
67
+
68
+ Useful keys: `Alt+Enter` inserts a newline, `Ctrl-C` cancels an in-flight turn, `Ctrl-T` focuses transcript view, then `Ctrl-P`/`Ctrl-N` moves between turns.
69
+
70
+ ## Project data
71
+
72
+ All per-project data lives under `~/.make-agent/`:
73
+
74
+ ```
75
+ ~/.make-agent/
76
+ └── <project-slug>/ # e.g. Users_alice_proj_myapp
77
+ ├── history # shell input history
78
+ ├── makefile/
79
+ │ ├── SYSTEM.md # default system prompt (copied from template on first run)
80
+ │ ├── skills/ # skill directories
81
+ │ └── memory.db # conversation history
82
+ └── logs/
83
+ └── make-agent.log
84
+ ```
85
+
86
+ The **project slug** is the absolute working-directory path with the leading `/` stripped and remaining `/` replaced by `_`.
87
+
88
+ ### System prompt discovery
89
+
90
+ Priority order (first match wins):
91
+
92
+ 1. `--system PROMPT` flag
93
+ 2. `--system-file FILE` flag
94
+ 3. `SYSTEM.md` in the current working directory
95
+ 4. `~/.make-agent/<project>/makefile/SYSTEM.md` (created from a bundled template on first run)
96
+
97
+ ## Skills
98
+
99
+ Each skill is a directory containing a single **`skill.mk`** file.
100
+
101
+ ```makefile
102
+ define DESCRIPTION
103
+ Searches files for a text pattern.
104
+ endef
105
+
106
+ .PHONY: search-files
107
+
108
+ search-files:
109
+ @grep -rn "$$PATTERN" "$$DIR" || echo "No matches found"
110
+ ```
111
+
112
+ The agent invokes targets via `make`, passing parameters as environment variables (`$$PARAM` in a recipe becomes `$PARAM` for the shell). The `define DESCRIPTION … endef` block is required and shown by `list_skills`.
113
+
114
+ ### Skill trust and approvals
115
+
116
+ `execute_skill` requires confirmation when a skill is not trusted. In interactive mode, the shell prompts `[Y] approve / [N] deny`.
117
+
118
+ Trust sources:
119
+
120
+ - `--trusted-skills all` trusts all skills.
121
+ - `--trusted-skills skill_name` trusts all targets in that skill.
122
+
123
+ ## Built-in tools
124
+
125
+ | Tool | What it does |
126
+ |---|---|
127
+ | `list_skills` | List available skills with descriptions |
128
+ | `read_skill` | Return the raw `skill.mk` content |
129
+ | `execute_skill(name, command)` | Run a make command against a skill's `skill.mk` |
130
+ | `create_skill` | Create or overwrite a skill (single `skill.mk` file) |
131
+ | `validate_skill` | Validate that a `skill.mk` exists and has a `DESCRIPTION` block |
132
+ | `write_file` | Write content to a file (sandboxed to the current working directory) |
133
+ | `edit_file` | Replace a string in a file (sandboxed to the current working directory) |
134
+
135
+ Use `--disable-builtin-tools` to turn off specific tools (or `all`).
136
+
137
+ Safety constraints:
138
+
139
+ - `write_file` and `edit_file` are sandboxed to paths inside the current working directory.
140
+ - `execute_skill` blocks dangerous make options (`-f/--file`, `-C/--directory`, `-I/--include-dir`, `--eval`).
141
+
142
+ ## Memory
143
+
144
+ Every conversation turn is persisted to a local SQLite database (`memory.db`), enabled by default.
145
+
146
+ The database is created at `~/.make-agent/<project>/makefile/memory.db`.
147
+
148
+ Three additional built-in tools are available:
149
+
150
+ | Tool | What it does |
151
+ |---|---|
152
+ | `get_recent_messages(limit, from_date, to_date)` | Return recent messages in chronological order |
153
+ | `search_user_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past user messages |
154
+ | `search_agent_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past agent replies |
155
+
156
+ **FTS5 search tips** — the search is keyword-based, not semantic:
157
+
158
+ - Use short keywords: `"goal project"` not `"what is the goal of this project"`
159
+ - Use `OR` for broader recall: `"goal OR objective OR purpose"`
160
+ - Stop words (`the`, `of`, `is`, `a`) are not indexed — omit them
161
+ - Fall back to `get_recent_messages` when you don't know which keywords to search for
162
+
163
+ ## Context compaction
164
+
165
+ When the context window is exceeded the agent automatically compacts conversation history and retries. Two strategies are available via `--compact-mode`:
166
+
167
+ - **`drop`** (default) — removes the oldest turns, keeping the most recent two.
168
+ - **`summarize`** — replaces prior turns with LLM-generated summaries, preserving more context at the cost of an extra API call.
169
+
170
+ Up to 3 compaction attempts are made before the request is aborted.
171
+
172
+ ## Development checks
173
+
174
+ ```
175
+ uv run pytest
176
+ uv run ruff check make_agent/
177
+ uv run ruff format make_agent/
178
+ ```
@@ -0,0 +1,152 @@
1
+ # make-agent
2
+
3
+ An AI agent powered by Makefile skills. Skills extend the agent with domain-specific instructions and shell tools.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ pip install makefile-agent
9
+ ```
10
+
11
+ Requires Python 3.11+ and a working `make` binary. Uses Anthropic and OpenAI SDKs for model access — set the appropriate provider API key in your environment (for example `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`).
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ make_agent [run] --model MODEL [--prompt PROMPT | --prompt-file FILE]
17
+ ```
18
+
19
+ | Flag | Default | Description |
20
+ |---|---|---|
21
+ | `--model MODEL` | — (required) | Model string (e.g. `claude-opus-4-5`, `gpt-4o`) |
22
+ | `--skills-dir DIR` | `~/.make-agent/<project>/makefile/skills/` | Directory containing skills |
23
+ | `--system PROMPT` | — | System prompt string (overrides SYSTEM.md discovery) |
24
+ | `--system-file FILE` | — | Read system prompt from FILE (overrides SYSTEM.md discovery) |
25
+ | `--prompt PROMPT` | — | Send a single prompt and exit (non-interactive) |
26
+ | `--prompt-file FILE` | — | Read a single prompt from FILE and exit |
27
+ | `--disable-builtin-tools TOOLS` | — | Comma-separated built-in tool names to disable, or `all` |
28
+ | `--trusted-skills SKILLS` | — | Comma-separated trusted skills or `all`; trusted skills run without confirmation |
29
+ | `--max-tool-output CHARS` | 32000 | Truncate tool output; `0` = unlimited |
30
+ | `--max-tokens N` | 4096 | Max tokens in the model response |
31
+ | `--reasoning-effort EFFORT` | `medium` | `none\|minimal\|low\|medium\|high\|xhigh` |
32
+ | `--prompt-cache` | disabled | Enable Anthropic system-prompt caching |
33
+ | `--compact-mode MODE` | `drop` | Context compaction strategy when context window is exceeded: `drop` removes oldest turns; `summarize` replaces turns with LLM-generated summaries |
34
+ | `--max-retries N` | 5 | Max retries on rate-limit errors |
35
+ | `--tool-timeout SECONDS` | 600 | Timeout per tool call |
36
+ | `--loglevel LEVEL` | `INFO` | `DEBUG\|INFO\|WARNING\|ERROR\|CRITICAL` |
37
+
38
+ Without `--prompt`, the agent starts an interactive full-screen REPL. Press Ctrl-D, `/exit`, or `/quit` to leave.
39
+
40
+ Interactive commands: `/help`, `/export` (save conversation to HTML), `/stats` (token usage totals), `/exit`, `/quit`.
41
+
42
+ Useful keys: `Alt+Enter` inserts a newline, `Ctrl-C` cancels an in-flight turn, `Ctrl-T` focuses transcript view, then `Ctrl-P`/`Ctrl-N` moves between turns.
43
+
44
+ ## Project data
45
+
46
+ All per-project data lives under `~/.make-agent/`:
47
+
48
+ ```
49
+ ~/.make-agent/
50
+ └── <project-slug>/ # e.g. Users_alice_proj_myapp
51
+ ├── history # shell input history
52
+ ├── makefile/
53
+ │ ├── SYSTEM.md # default system prompt (copied from template on first run)
54
+ │ ├── skills/ # skill directories
55
+ │ └── memory.db # conversation history
56
+ └── logs/
57
+ └── make-agent.log
58
+ ```
59
+
60
+ The **project slug** is the absolute working-directory path with the leading `/` stripped and remaining `/` replaced by `_`.
61
+
62
+ ### System prompt discovery
63
+
64
+ Priority order (first match wins):
65
+
66
+ 1. `--system PROMPT` flag
67
+ 2. `--system-file FILE` flag
68
+ 3. `SYSTEM.md` in the current working directory
69
+ 4. `~/.make-agent/<project>/makefile/SYSTEM.md` (created from a bundled template on first run)
70
+
71
+ ## Skills
72
+
73
+ Each skill is a directory containing a single **`skill.mk`** file.
74
+
75
+ ```makefile
76
+ define DESCRIPTION
77
+ Searches files for a text pattern.
78
+ endef
79
+
80
+ .PHONY: search-files
81
+
82
+ search-files:
83
+ @grep -rn "$$PATTERN" "$$DIR" || echo "No matches found"
84
+ ```
85
+
86
+ The agent invokes targets via `make`, passing parameters as environment variables (`$$PARAM` in a recipe becomes `$PARAM` for the shell). The `define DESCRIPTION … endef` block is required and shown by `list_skills`.
87
+
88
+ ### Skill trust and approvals
89
+
90
+ `execute_skill` requires confirmation when a skill is not trusted. In interactive mode, the shell prompts `[Y] approve / [N] deny`.
91
+
92
+ Trust sources:
93
+
94
+ - `--trusted-skills all` trusts all skills.
95
+ - `--trusted-skills skill_name` trusts all targets in that skill.
96
+
97
+ ## Built-in tools
98
+
99
+ | Tool | What it does |
100
+ |---|---|
101
+ | `list_skills` | List available skills with descriptions |
102
+ | `read_skill` | Return the raw `skill.mk` content |
103
+ | `execute_skill(name, command)` | Run a make command against a skill's `skill.mk` |
104
+ | `create_skill` | Create or overwrite a skill (single `skill.mk` file) |
105
+ | `validate_skill` | Validate that a `skill.mk` exists and has a `DESCRIPTION` block |
106
+ | `write_file` | Write content to a file (sandboxed to the current working directory) |
107
+ | `edit_file` | Replace a string in a file (sandboxed to the current working directory) |
108
+
109
+ Use `--disable-builtin-tools` to turn off specific tools (or `all`).
110
+
111
+ Safety constraints:
112
+
113
+ - `write_file` and `edit_file` are sandboxed to paths inside the current working directory.
114
+ - `execute_skill` blocks dangerous make options (`-f/--file`, `-C/--directory`, `-I/--include-dir`, `--eval`).
115
+
116
+ ## Memory
117
+
118
+ Every conversation turn is persisted to a local SQLite database (`memory.db`), enabled by default.
119
+
120
+ The database is created at `~/.make-agent/<project>/makefile/memory.db`.
121
+
122
+ Three additional built-in tools are available:
123
+
124
+ | Tool | What it does |
125
+ |---|---|
126
+ | `get_recent_messages(limit, from_date, to_date)` | Return recent messages in chronological order |
127
+ | `search_user_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past user messages |
128
+ | `search_agent_memory(query, limit, from_date, to_date)` | FTS5 keyword search over past agent replies |
129
+
130
+ **FTS5 search tips** — the search is keyword-based, not semantic:
131
+
132
+ - Use short keywords: `"goal project"` not `"what is the goal of this project"`
133
+ - Use `OR` for broader recall: `"goal OR objective OR purpose"`
134
+ - Stop words (`the`, `of`, `is`, `a`) are not indexed — omit them
135
+ - Fall back to `get_recent_messages` when you don't know which keywords to search for
136
+
137
+ ## Context compaction
138
+
139
+ When the context window is exceeded the agent automatically compacts conversation history and retries. Two strategies are available via `--compact-mode`:
140
+
141
+ - **`drop`** (default) — removes the oldest turns, keeping the most recent two.
142
+ - **`summarize`** — replaces prior turns with LLM-generated summaries, preserving more context at the cost of an extra API call.
143
+
144
+ Up to 3 compaction attempts are made before the request is aborted.
145
+
146
+ ## Development checks
147
+
148
+ ```
149
+ uv run pytest
150
+ uv run ruff check make_agent/
151
+ uv run ruff format make_agent/
152
+ ```
@@ -0,0 +1,104 @@
1
+ from .agent import Agent, AgentManager, SessionNotFoundError
2
+ from .bridge import (
3
+ ApprovalRequested,
4
+ ApproveSkill,
5
+ CancelTurn,
6
+ DenySkill,
7
+ HistoryCompacted,
8
+ ManagerError,
9
+ ShellCommand,
10
+ ShellEvent,
11
+ Shutdown,
12
+ StartTurn,
13
+ StatusChanged,
14
+ ToolFinished,
15
+ ToolStarted,
16
+ TokenEmitted,
17
+ TurnCancelled,
18
+ TurnFinished,
19
+ TurnStarted,
20
+ )
21
+ from .constants import (
22
+ DEFAULT_COMPACT_MODE,
23
+ DEFAULT_MAX_RETRIES,
24
+ DEFAULT_MAX_TOKENS,
25
+ DEFAULT_MAX_TOOL_OUTPUT,
26
+ DEFAULT_REASONING_EFFORT,
27
+ DEFAULT_TOOL_TIMEOUT,
28
+ DEFAULT_USE_PROMPT_CACHE,
29
+ )
30
+ from .events import (
31
+ AgentEvent,
32
+ CompactEvent,
33
+ ConfirmEvent,
34
+ DoneEvent,
35
+ TokenEvent,
36
+ ToolDoneEvent,
37
+ ToolStartEvent,
38
+ UsageEvent,
39
+ )
40
+ from .export import _render_html, export_conversation
41
+ from .loop import (
42
+ AgentConfig,
43
+ AgenticLoop,
44
+ CallBack,
45
+ CompactCallback,
46
+ MessageCallback,
47
+ TokenCallback,
48
+ ToolCallback,
49
+ UsageCallback,
50
+ )
51
+ from .middleware import MiddlewareBase, Request, Response, SessionMiddleware
52
+
53
+ __all__ = [
54
+ "DEFAULT_COMPACT_MODE",
55
+ "DEFAULT_MAX_RETRIES",
56
+ "DEFAULT_MAX_TOKENS",
57
+ "DEFAULT_MAX_TOOL_OUTPUT",
58
+ "DEFAULT_REASONING_EFFORT",
59
+ "DEFAULT_TOOL_TIMEOUT",
60
+ "DEFAULT_USE_PROMPT_CACHE",
61
+ "Agent",
62
+ "AgentConfig",
63
+ "AgentEvent",
64
+ "AgenticLoop",
65
+ "AgentManager",
66
+ "ApprovalRequested",
67
+ "ApproveSkill",
68
+ "CancelTurn",
69
+ "CompactEvent",
70
+ "ConfirmEvent",
71
+ "DenySkill",
72
+ "DoneEvent",
73
+ "HistoryCompacted",
74
+ "ManagerError",
75
+ "MiddlewareBase",
76
+ "Request",
77
+ "Response",
78
+ "SessionMiddleware",
79
+ "SessionNotFoundError",
80
+ "ShellCommand",
81
+ "ShellEvent",
82
+ "Shutdown",
83
+ "StartTurn",
84
+ "StatusChanged",
85
+ "ToolFinished",
86
+ "ToolStarted",
87
+ "TokenEmitted",
88
+ "TokenEvent",
89
+ "ToolDoneEvent",
90
+ "ToolStartEvent",
91
+ "TurnCancelled",
92
+ "TurnFinished",
93
+ "TurnStarted",
94
+ "_render_html",
95
+ "export_conversation",
96
+ # Internal — kept for AgenticLoop.arun() and tests only:
97
+ "CallBack",
98
+ "CompactCallback",
99
+ "MessageCallback",
100
+ "TokenCallback",
101
+ "ToolCallback",
102
+ "UsageCallback",
103
+ "UsageEvent",
104
+ ]