Skip to content

feat(agent-runner): prepare 4.11.x SDK protocol support#88

Open
huanghuoguoguo wants to merge 87 commits into
mainfrom
dev/4.11.x
Open

feat(agent-runner): prepare 4.11.x SDK protocol support#88
huanghuoguoguo wants to merge 87 commits into
mainfrom
dev/4.11.x

Conversation

@huanghuoguoguo

Copy link
Copy Markdown
Collaborator

Scope

This PR prepares the SDK side of the 4.11.x AgentRunner / EBA integration branch.

Included in this branch:

  • AgentRunner component base class, manifest entities, context/result/state/resource/run-ledger entities, and compatibility exports.
  • Runtime discovery and RUN_AGENT forwarding for AgentRunner components.
  • Run-scoped Host API proxy split across resource, context, state, ledger, and admin surfaces.
  • Agent tools MCP bridge, asset gateway, daemon relay primitives, and skill-as-tool resource support.
  • EBA platform/event entity additions used by the matching LangBot host branch.
  • SDK docs updated with current branch sync status and verification commands.

Current status

Done / unit covered:

  • Typed AgentRunner entities and proxy APIs.
  • Runtime manager AgentRunner discovery and execution path.
  • Pull API handlers and action consistency with the Host action surface.
  • MCP bridge and asset/skill tool resource surface.

Still intentionally out of scope for this PR:

  • Hosted Agent Platform product layer.
  • Built-in Claude/Codex/ACP adapters inside the SDK package.
  • Daemon supervisor and distributed runtime management.

Verification

  • 311 passed, 10 warnings
  • uv run python scripts/check_action_consistency.py passed.
  • The action consistency check reports only the existing CommonAction.HEARTBEAT warning, which is host-handled / not SDK-registered.

RockChinQ and others added 30 commits May 7, 2026 15:20
- Add EBAEvent hierarchy with all unified events (message.*, group.*, friend.*, bot.*, platform.specific)
- Add User, UserGroup, UserGroupMember, ChatType, MemberRole entities
- Add AbstractPlatformAdapter with optional APIs and capability declaration
- Add NotSupportedError for unimplemented optional APIs
- All additions are backward-compatible; existing classes unchanged
# Conflicts:
#	pyproject.toml
#	src/langbot_plugin/version.py
Phase 0 integration complete - LangBot + SDK + runner repo minimal loop verified.

Key changes:
- Add RUN_AGENT action forwarding from runtime to plugin process
- Add AgentRunner to preinitialize_component_classes for initialization
- Implement Protocol v1 entities: AgentRunContext, AgentRunResult, capabilities, permissions
- Add resp_message_id field to Message class for LangBot integration
- Fix AgentInput.message_chain to accept list type (matches LangBot data)
- Add comprehensive tests for AgentRunner protocol

Integration verified: plugin:langbot/local-agent/default returns [stub] Echo response.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…support

- Refactor AgentRunAPIProxy to inherit from LangBotAPIProxy, reducing code duplication
- Pre-compute allowed resource IDs (frozenset) in __init__ for O(1) permission validation
- Add STATE_SCOPE_LITERAL type annotation in AgentRunResult.state_updated()
- Add AgentRunState TypedDict with 4 scopes (conversation, actor, subject, runner)
- Remove unused base64 import from agent_run_api.py
- Update documentation for params and state protocol

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Improve AgentRunAPIProxy with state scope support (conversation/session/run)
- Enhance plugin handler for agent run operations
- Add better error handling and logging
Add record of all 7 runner plugins migration completed on 2026-05-13
- Add INVOKE_RERANK to PluginToRuntimeAction enum
- Add invoke_rerank() method to AgentRunAPIProxy
- Support reranking documents with relevance scores
Reduces code duplication by composing LangBotAPIProxy instead of
directly calling plugin_runtime_handler. Adds get_tool_detail() for
LLM function calling support.

Changes:
- Compose LangBotAPIProxy for delegated API calls
- Add permission validation before each delegation
- Add get_tool_detail() method for tool schema fetching
- Reduce from ~460 lines to ~350 lines
Define Protocol v1 AgentRunContext with required fields: event, delivery,
context (ContextAccess), bootstrap, compatibility, metadata. Add history
and event pull APIs to AgentRunAPIProxy with run_id authorization.

Key changes:
- AgentRunContext: Protocol v1 structure with required event/delivery fields
- AgentEventContext: event_id, event_type, source required
- DeliveryContext: surface, streaming/edit/reaction capabilities
- ContextAccess: inline_policy, available_apis for pull APIs
- BootstrapContext: optional bootstrap messages (NOT core history)
- CompatibilityContext: legacy Query/Pipeline fields for migration
- AgentRunResult factories: all require run_id parameter
- AgentRunAPIProxy: history_page, history_search, event_get, event_page
- PluginToRuntimeAction: HISTORY_PAGE, HISTORY_SEARCH, EVENT_GET, EVENT_PAGE
- Legacy helpers: to_v1_result(run_id), create_legacy_context with event/delivery

Runner docs updated: use ctx.run_id in factories, ctx.bootstrap.messages
instead of ctx.messages (demoted to bootstrap for Protocol v1).
huanghuoguoguo and others added 23 commits June 22, 2026 11:16
Move the scoped type-check module list out of the test.yml workflow into a
top-level mypy.ini ([mypy] files). The CI step becomes a generic
`uv run mypy`, so the workflow no longer enumerates AgentRunner/MCP/daemon
business modules; the scope is versioned with the source and reproducible
locally with `uv run mypy`.
- ToolResource gains a parameters field (full JSON schema) so the host can
  prefill it and runners build LLM tools without get_tool_detail round-trips
- langbot_list_assets exposes a 'skills' asset class so external harnesses
  can discover pipeline-visible skills under the unified tool model
# Conflicts:
#	pyproject.toml
#	src/langbot_plugin/version.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants