Skip to content

feat: pass live agent context to plugin tools#7345

Open
ian-pascoe wants to merge 1 commit into
NousResearch:mainfrom
ian-pascoe:feat/plugin-runtime-seam
Open

feat: pass live agent context to plugin tools#7345
ian-pascoe wants to merge 1 commit into
NousResearch:mainfrom
ian-pascoe:feat/plugin-runtime-seam

Conversation

@ian-pascoe

Copy link
Copy Markdown

Summary

  • pass live agent context through the agent loop to plugin-provided tools
  • keep built-in tool behavior unchanged by only exposing agent to plugin tool names
  • add tests proving plugin handlers can receive and use live runtime context

Why

Maintainers requested a plugin-first path for the reasoning effort feature. Plugin tool handlers currently cannot access the live AIAgent, which blocks plugin-owned session-state mutations like updating agent.reasoning_config.

This PR adds a small generic seam so plugin tools can receive:

  • agent
  • task_id
  • session_id
  • tool_call_id

That enables richer plugin behaviors without hardcoding feature logic into core.

Implementation notes

  • model_tools.handle_function_call(...) now accepts optional agent
  • run_agent.py passes agent=self from the live agent loop
  • only plugin-provided tools receive the live agent kwarg
  • PluginContext.register_tool(...) docs now mention runtime kwargs

Test plan

uv run --with pyyaml --with pytest --with pytest-asyncio python -m pytest -o addopts='' tests/hermes_cli/test_plugins.py tests/run_agent/test_run_agent.py -q

Passed locally:

  • 270 passed

Closes #7344

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins comp/agent Core agent loop, run_agent.py, prompt builder comp/tools Tool registry, model_tools, toolsets labels Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder comp/plugins Plugin system and bundled plugins comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose live agent context to plugin tool handlers

2 participants