# API Shift

- **Event:** [Meta Global AI Developer Hackathon](https://cerebralvalley.ai/e/meta-ai-developer-hackathon)
- **When:** Oct 26, 12:00 PM – Nov 4, 9:00 PM (EST)
- **Where:** Online
- **Team:** [Pranav Nemani](https://cerebralvalley.ai/u/pnemani)
- **GitHub:** https://github.com/pranavnemani/APIShift
- **Demo video:** https://youtu.be/mxQhtfHQn8o
- **Gallery:** https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery
- **Page:** https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3436

Every production application depends on third-party APIs. When an upstream API ships a breaking major release (renamed endpoints, reshaped schemas, required auth headers), development freezes. Engineers lose days hunting call sites, cross-referencing changelogs, and hoping existing tests catch regressions.

APIShift is an autonomous, contract-driven API migration engine powered by Meta's Muse models. When an upstream API ships a breaking version, APIShift:


1. Deterministically diffs old and new OpenAPI specifications to extract every breaking protocol change.
2. Deploys Scout (Muse Spark) to synthesize changes into explicit migration rules.
3. Deploys Analyst (Muse Spark in an interactive tool loop) to walk AST symbols and call graphs, mapping affected files and downstream consumers that never call the API directly.
4. Deploys Refactor (Muse Wonder) to generate atomic search/replace patches (e.g., client adapter layers preserving internal types).
5. Proves the fix inside an isolated Docker sandbox with zero network access and strict, code-enforced guardrails.
6. Self-Heals via a Triage & Validator loop: If tests fail, Triage (Muse Spark) diagnoses the failure signature and routes corrections back to Refactor or Analyst (up to 3 retries (heals)).
7. Yields a reviewable GitHub Pull Request with full trace evidence, or a draft labeled `needs-human` if unresolved.

Zero Framework Bloat (No LangGraph):
By leveraging Meta's native Model API (/v1/responses), the included native tool calling, wire-level strict JSON schemas, and prompt caching I was able to avoid and include:

- Bloated agent frameworks such as LangGraph or CrewAI. 
- APIShift runs on a clean, deterministic Python state machine
- 100% auditable transitions and zero hidden prompt injections

Why You Can Trust a Green Run (Immutable Test Oracle):
Unlike agents that hallucinate success by disabling tests: APIShift treats your test suite as an immutable oracle enforced in code.

- Tests, pytest.ini, and conftest.py are mounted read-only (:ro) in Docker and SHA-256 fingerprinted before and after execution.
- Any patch attempting to inject pytest.mark.skip, xfail, or touch files outside the impact graph is atomically rejected.
- Exact test collection invariant: The sandbox verifies the exact same number of tests run on v2 as on v1.

Verified Benchmark (Live Weather API v1 → v2):

- Baseline on v2: 4/14 tests passing.
- APIShift output: 14/14 passing tests in 1 attempt.
- Resource footprint: 8 model calls, 146 seconds, and only $0.111 in total API spend.

## More from Meta Global AI Developer Hackathon

- [TraceMend](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3433)
- [Ketchup](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3434)
- [personavision - Swarm of AI agents that test UX before real users](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3435)
- [Ghost AI Systems](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3437)
- [Praesidia.AI](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3438)
- [Rangga Kori Lesmana](https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3439)

---

Markdown version of https://cerebralvalley.ai/e/meta-ai-developer-hackathon/hackathon/gallery/3436. Site index for agents: https://cerebralvalley.ai/llms.txt · full text: https://cerebralvalley.ai/llms-full.txt
