8 Commits

Author SHA1 Message Date
CoreRasurae 4b354f5b2d feat(agents): surface timeout budget in tool schemas and errors
CI / lint (pull_request) Successful in 50s
CI / quality (pull_request) Successful in 55s
CI / security (pull_request) Successful in 1m25s
CI / typecheck (pull_request) Successful in 1m34s
CI / build (pull_request) Successful in 1m34s
CI / integration_tests (pull_request) Successful in 5m18s
CI / unit_tests (pull_request) Successful in 6m38s
CI / benchmark (pull_request) Failing after 42m6s
CI / lint (push) Successful in 47s
CI / typecheck (push) Successful in 1m26s
CI / security (push) Successful in 1m9s
CI / quality (push) Successful in 50s
CI / build (push) Successful in 1m36s
CI / integration_tests (push) Successful in 3m45s
CI / unit_tests (push) Successful in 5m42s
CI / coverage (push) Successful in 4m44s
CI / status-check (push) Successful in 6s
CI / benchmark (push) Successful in 44m16s
CI / coverage (pull_request) Successful in 4m57s
CI / status-check (pull_request) Successful in 7s
The `shell` and `http_request` built-in tools are the only two whose
execution actually honors the tool agent's `timeout` config field
(ToolAgent._execute_shell_command, ToolAgent._http_request_tool), but
their LLM-facing schemas (_BUILTIN_TOOL_SCHEMAS in llm_tools.py) never
told the model a timeout applied, and neither tool's timeout error
named the config field that controls it.

- _BUILTIN_TOOL_SCHEMAS["shell"] and ["http_request"] descriptions now
  state that execution is bounded by the agent's configured `timeout`
  (seconds), matching the existing precedent of documenting `file_read`'s
  `max_chars` behavior in its schema.
- _execute_shell_command's timeout ExecutionError now names `timeout`
  as the adjustable config field, in addition to the elapsed seconds it
  already reported.
- _http_request_tool now catches asyncio.TimeoutError distinctly from
  the generic `except Exception`, so a request timeout produces a
  message naming the config field instead of the previous generic
  "HTTP request failed" text (which gave no indication a timeout was
  the cause). Non-timeout HTTP failures are unaffected — same
  exception handling, same message shape as before.

No change to enforcement mechanics: `self.timeout` remains the sole
config field (default 1s, Actor Configuration Standard §4.5). This is
schema/message content only, within the extension precedent already
established by ADR-2030 (D-1 schema registry, D-4/D-6 error-quality
improvements) — no new ADR was needed for this change.

Tests: extended features/tool_agent.feature (updated the two existing
shell/http_request timeout scenarios to also assert the new config-field
hint) and features/llm_tools_coverage.feature (new scenarios asserting
both schema descriptions mention the timeout budget). Full suite:
141 features / 2782 scenarios / 13172 steps passed; coverage 96.8%
(>=96.5% threshold). Robot integration_tests: 27/27 suites passed.
ASV benchmark_regression: no significant change, as expected for a
messaging-only change.

ISSUES CLOSED: #82
2026-07-30 19:29:54 +01:00
CoreRasurae bcce5dc42a fix(agents): validate tool name against declared tools list before dispatch
CI / lint (pull_request) Successful in 43s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 46s
CI / quality (pull_request) Successful in 31s
CI / unit_tests (pull_request) Successful in 3m1s
CI / integration_tests (pull_request) Successful in 1m1s
CI / build (pull_request) Successful in 31s
CI / coverage (pull_request) Successful in 3m2s
CI / status-check (pull_request) Successful in 2s
CI / lint (push) Successful in 31s
CI / typecheck (push) Successful in 46s
CI / security (push) Successful in 47s
CI / quality (push) Successful in 30s
CI / unit_tests (push) Successful in 3m9s
CI / integration_tests (push) Successful in 1m7s
CI / build (push) Successful in 37s
CI / coverage (push) Successful in 3m11s
CI / status-check (push) Successful in 3s
ISSUES CLOSED: #63
2026-06-30 12:06:05 +01:00
CoreRasurae 227e2feece feat(agents): implement multi-turn tool-call loop and sandbox improvements
CI / build (pull_request) Successful in 45s
CI / quality (pull_request) Successful in 58s
CI / lint (pull_request) Successful in 1m15s
CI / typecheck (pull_request) Successful in 1m15s
CI / security (pull_request) Successful in 1m15s
CI / integration_tests (pull_request) Successful in 1m24s
CI / unit_tests (pull_request) Successful in 3m25s
CI / coverage (pull_request) Successful in 3m10s
CI / status-check (pull_request) Successful in 6s
CI / lint (push) Successful in 42s
CI / quality (push) Successful in 48s
CI / typecheck (push) Successful in 51s
CI / security (push) Successful in 49s
CI / build (push) Successful in 47s
CI / integration_tests (push) Successful in 1m10s
CI / unit_tests (push) Successful in 3m9s
CI / coverage (push) Successful in 3m7s
CI / status-check (push) Successful in 3s
Implements the complete LLM agent tool-calling pipeline — the tool-calling
path was broken in multiple ways: tools from agent config were not passed
to the LLM, tool execution was single-pass (the model could not see tool
results or make follow-up calls), tool errors were discarded, and shell/
python_exec tools were never registered.

Key changes:

- Multi-turn tool-call loop: passes tools to the LLM via ainvoke(tools=...)
  and re-invokes after each batch of ToolResults, with a configurable
  round limit (tool_max_rounds config / TOOL_MAX_ROUNDS env var, default 20).

- Tool schema module (llm_tools.py): normalize_tool_entry() converts
  string tool names and config dicts to OpenAI function-calling format
  with full parameter schemas and LLM-facing guidance (max_chars for
  file_read, sandbox builtins for python_exec, etc.).

- file_read enhancements: directory listing with file sizes and type
  indicators, max_chars truncation to prevent context overflow, shell
  command detection with redirect to shell tool, file-not-found
  recovery hints with parent directory listing.

- python_exec sandbox: stdout capture so print() produces visible
  output, NameError guidance directing LLM to file_read/file_write
  instead of using open().

- shell/python_exec tool registration in builtin_tools when
  allow_shell / exec_python is enabled.

- create_subprocess_shell for shell commands (was create_subprocess_exec,
  which blocks pipes/redirections/chains).

- Tool error propagation: ExecutionError/ConfigurationError details
  included in ToolMessages for LLM self-correction.

- Stuck-model recovery: injects synthesizing prompt when model
  exhausts tool rounds without producing content.

- LLM provider error details preserved in ExecutionError messages
  instead of generic "LLM processing failed".

- Empty message filtering in _prepare_conversation_history() prevents
  whitespace-only messages from polluting downstream conversation
  history in multi-agent pipelines.

Closes #59
2026-06-23 12:39:20 +01:00
CleverThis Engineering df468f821f style: apply end-of-file and whitespace fixes across feature files 2026-05-27 21:41:03 +00:00
CleverThis Engineering 7323a4e88a tests: add behave bdd test cases for new changes 2026-05-26 21:53:18 +00:00
CleverThis Engineering c5c5765677 test: added new tests to improve coverage. 2026-05-26 21:53:17 +00:00
CleverThis Engineering f79ab8223e Converted code to use RxPy for its routes 2026-05-26 21:53:16 +00:00
CleverThis Engineering 4018a742ed feat: migrate project to CleverActors with new features and tests 2026-05-26 21:53:15 +00:00