Skip to content

feat: Python SDK feature parity — core types, hooks, tools, triggers, interactive loop#5

Merged
codeitlikemiley merged 6 commits into
mainfrom
feat/python-sdk-parity
May 29, 2026
Merged

feat: Python SDK feature parity — core types, hooks, tools, triggers, interactive loop#5
codeitlikemiley merged 6 commits into
mainfrom
feat/python-sdk-parity

Conversation

@codeitlikemiley

Copy link
Copy Markdown
Owner

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)

File Description
src/error.rs Typed error hierarchy: AntigravityError (Connection, Execution, Validation)
src/context.rs Hierarchical HookContext state store (Session→Turn→Operation)
src/tool_context.rs Session-scoped ToolContext with state store and agent communication
src/trigger_helpers.rs every() periodic trigger factory
src/interactive.rs run_interactive_loop() REPL utility (native only)

Extended Modules (4 files)

File Changes
src/hooks.rs Added on_session_end, post_turn, on_compaction hooks + dispatchers + tests
src/tools.rs Added needs_context() / call_with_context() for context-aware tools
src/types.rs Added multimodal pipeline (Media, Content, MimeType — 32 extensions), trigger types
src/lib.rs Wired all new modules into public API

Documentation

File Changes
README.md Added 7 new sections: Error Handling, Multimodal Content, Lifecycle Hooks, Hook Context, Context-Aware Tools, Trigger Helpers, Interactive Loop

Python SDK Feature Mapping

Python Feature Rust Implementation Status
AntigravityConnectionError / AntigravityValidationError AntigravityError::Connection / AntigravityError::Validation
Image, Document, Audio, Video, Content Media, Content, MimeType enums
SessionContextTurnContextOperationContext HookContext::new() / HookContext::child()
ToolContext with get_state/set_state ToolContext struct
on_session_end, post_turn, on_compaction Hook trait methods
every() trigger helper trigger_helpers::every()
run_interactive_loop() interactive::run_interactive_loop()

Testing

  • 90 unit tests — all pass
  • 4 integration tests — all pass
  • 4 doc-tests — all pass (including new modules)
  • cargo clippy --all-targets -- -D warnings0 warnings

Backwards Compatibility

All changes are fully backwards compatible:

  • New hook methods have default no-op implementations
  • Tool::needs_context() defaults to false
  • Existing PolicyEnforcer uses defaults automatically
  • No breaking changes to public API

- 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
@codeitlikemiley codeitlikemiley merged commit 11853ec into main May 29, 2026
1 check passed
@codeitlikemiley

Copy link
Copy Markdown
Owner Author

/ecc-tools analyze

@ecc-tools

ecc-tools Bot commented Jun 7, 2026

Copy link
Copy Markdown

Analysis Queued

Analyzing codeitlikemiley/antigravity-sdk-rust on pull request head c945a43b3130

Analysis Pipeline
Stage Description Status
Compare Snapshot Resolving PR head/base diff before branch fallback pending
Commit History Fetching up to 200 commits (queued-mode cap) pending
File Sampling Extracting code patterns and structure pending
Pattern Detection AI analysis of conventions and workflows pending
Bundle Generation Creating skills, rules, commands, identity, and instincts pending
Pull Request Opening PR with generated files pending

Estimated time: 2-5 minutes depending on repository size.


10/10 analyses remaining this month (free tier) | ECC Tools

@ecc-tools

ecc-tools Bot commented Jun 7, 2026

Copy link
Copy Markdown

Analyzing 200 commits...

@ecc-tools

ecc-tools Bot commented Jun 7, 2026

Copy link
Copy Markdown

Analysis Complete

Generated ECC bundle from 6 commits | Confidence: 55%

View Pull Request #6

Repository Profile
Attribute Value
Language Rust
Framework Not detected
Commit Convention conventional
Test Directory separate
Changed Files (20)
Metric Value
Files changed 20
Additions 4438
Deletions 5

Top hotspots

Path Status +/-
docs/agent.md added +696 / -0
docs/hooks.md added +608 / -0
src/types.rs modified +531 / -0
docs/conversation.md added +408 / -0
docs/connections.md added +386 / -0

Top directories

Directory Files Total changes
docs 7 2961
src 11 1243
. 1 238
tests 1 1
Analysis Depth Readiness (commit-history, 14%)

ECC Tools uses this to decide whether recommendations should stay at commit-history/setup guidance or expand into CI, security, harness, reference-set, AI-routing, and team backlog work.

Area Status Evidence / Next Step
Commit history Ready 6 commits sampled
CI/CD signals Missing Add workflow files or CI troubleshooting evidence so ECC Tools can reason about pipeline setup.
Security evidence Missing Add AgentShield, audit, SARIF, SBOM, or security review evidence so recommendations can cover security posture.
Harness configuration Missing Add Claude, Codex, OpenCode, Zed, dmux, MCP, plugin, or cross-harness config evidence for harness-agnostic recommendations.
Reference/eval evidence Missing Add fixtures, golden traces, reference sets, or evaluator benchmarks so deeper recommendations have regression evidence.
AI routing and cost controls Missing Add model-routing, budget, usage, or cost-control files before relying on AI-heavy automation recommendations.
Team handoff and project tracking Missing Add roadmap, runbook, project, Linear, or follow-up tracking docs so generated work can land in a team queue.
Reference Set Readiness (0/7, 0%)
Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.
Likely Future Issues (1)
Severity Signal Why it may show up
HIGH Security-sensitive changes may ship without scanner evidence 1 security-sensitive paths changed; 0 security scanner or security-focused validation artifacts changed
  • Security-sensitive changes may ship without scanner evidence: The PR touches billing, secrets, auth, webhooks, agent, or CI-sensitive surfaces without adding obvious security scanner, code scanning, or security-focused validation evidence.
Suggested Follow-up Work (1)
Type Suggested title Targets
PR security: add scanner evidence for src/agent.rs src/agent.rs
  • security: add scanner evidence for src/agent.rs: Backfill explicit scanner or code-scanning evidence before another security-sensitive change lands on the touched surface.

Copy-ready bodies

security: add scanner evidence for src/agent.rs

## Summary
- Add security scanner or code-scanning evidence for the recently changed security-sensitive surface.

## Why
- Backfill explicit scanner or code-scanning evidence before another security-sensitive change lands on the touched surface.

## Touched paths
- `src/agent.rs`

## Validation
- Run or add the relevant security scanner, code scanning, secret scanning, or dependency/security review check for the touched surface.
- Attach the scanner output, SARIF/code-scanning result, or focused security regression test to the follow-up PR.
- Confirm the changed auth, billing, webhook, secret-handling, agent, or CI surface has an explicit pass/fail gate.
Detected Workflows (3)
Workflow Description
feature-development Standard feature implementation workflow
feature-implementation-and-wiring Implements a new core feature or module, then wires it into the main library entry point and supporting files.
documentation-update-after-feature Updates documentation files and README to reflect new features, components, or API changes.
Generated Instincts (21)
Domain Count
git 3
code-style 9
testing 3
workflow 6

After merging, import with:

/instinct-import .claude/homunculus/instincts/inherited/antigravity-sdk-rust-instincts.yaml

Files

  • .claude/ecc-tools.json
  • .claude/skills/antigravity-sdk-rust/SKILL.md
  • .agents/skills/antigravity-sdk-rust/SKILL.md
  • .agents/skills/antigravity-sdk-rust/agents/openai.yaml
  • .claude/identity.json
  • .codex/config.toml
  • .codex/AGENTS.md
  • .codex/agents/explorer.toml
  • .codex/agents/reviewer.toml
  • .codex/agents/docs-researcher.toml
  • .claude/homunculus/instincts/inherited/antigravity-sdk-rust-instincts.yaml
  • .claude/commands/feature-development.md
  • .claude/commands/feature-implementation-and-wiring.md
  • .claude/commands/documentation-update-after-feature.md

ECC Tools | Everything Claude Code

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.

1 participant