feat: Python SDK feature parity — core types, hooks, tools, triggers, interactive loop#5
Merged
Merged
Conversation
- Add AntigravityError enum (Connection, Execution, Validation) in error.rs - Add HookContext hierarchical state store (Session→Turn→Operation) in context.rs - Add ToolContext with session-scoped state and agent communication in tool_context.rs - Add multimodal content pipeline: Media, Content, MimeType (32 extensions) - Add trigger types: TriggerDelivery, FileChange, FileChangeKind
- Add on_session_end, post_turn, on_compaction hooks to Hook/DynHook traits - Add dispatch_session_end, dispatch_post_turn, dispatch_on_compaction to HookRunner - Add needs_context() and call_with_context() to Tool/DynTool traits - All additions are backwards compatible with default implementations
- Add trigger_helpers.rs with every() periodic trigger factory - Add interactive.rs with run_interactive_loop() REPL (native only) - Wire all new modules in lib.rs: context, error, tool_context, trigger_helpers, interactive
- Add Error Handling section with AntigravityError - Add Multimodal Content section with Content/Media/MimeType - Add Lifecycle Hooks section showing full hook API - Add Hook Context section with hierarchical state - Add Context-Aware Tools section with ToolContext - Add Trigger Helpers section with every() factory - Add Interactive Loop section with run_interactive_loop()
- Add mcp_servers field to AgentConfig - Add .mcp_server() and .mcp_servers() builder methods - Wire MCP configs through Agent::start() to LocalConnectionStrategy - Add mcp_servers to LocalConnectionStrategy struct and constructor - Fix all call sites (tests, README example)
- Add docs/agent.md — Agent builder, typestate, lifecycle - Add docs/connections.md — Connection trait, Local/WASM strategies - Add docs/conversation.md — Stateful sessions, streaming, chunks - Add docs/hooks.md — Hook trait, context, policy enforcer - Add docs/mcp.md — MCP server config, builder, policies - Add docs/tools.md — Tool trait, context-aware tools, ToolRunner - Add docs/triggers.md — Trigger trait, helpers, file watchers - Add MCP Integration section to README - Add Sugared Thoughts & Tool Call Streams section to README - Add Component Documentation links to README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements full feature parity between the Rust and Python Antigravity SDKs, closing all identified gaps from the SDK comparison analysis.
Changes
New Modules (5 files)
src/error.rsAntigravityError(Connection, Execution, Validation)src/context.rsHookContextstate store (Session→Turn→Operation)src/tool_context.rsToolContextwith state store and agent communicationsrc/trigger_helpers.rsevery()periodic trigger factorysrc/interactive.rsrun_interactive_loop()REPL utility (native only)Extended Modules (4 files)
src/hooks.rson_session_end,post_turn,on_compactionhooks + dispatchers + testssrc/tools.rsneeds_context()/call_with_context()for context-aware toolssrc/types.rssrc/lib.rsDocumentation
README.mdPython SDK Feature Mapping
AntigravityConnectionError/AntigravityValidationErrorAntigravityError::Connection/AntigravityError::ValidationImage,Document,Audio,Video,ContentMedia,Content,MimeTypeenumsSessionContext→TurnContext→OperationContextHookContext::new()/HookContext::child()ToolContextwithget_state/set_stateToolContextstructon_session_end,post_turn,on_compactionHooktrait methodsevery()trigger helpertrigger_helpers::every()run_interactive_loop()interactive::run_interactive_loop()Testing
cargo clippy --all-targets -- -D warnings— 0 warningsBackwards Compatibility
All changes are fully backwards compatible:
Tool::needs_context()defaults tofalsePolicyEnforceruses defaults automatically