grip-sdk

The official Python client and development library for Grip AI — Dynamic multi-provider search, deep reasoning token streaming, and conversational sessions.

Overview

grip-sdk is the official, high-performance developer library for Grip AI. It allows Python applications and AI agents to query live grounded web information, stream reasoning tokens in real-time, maintain multi-turn conversational history, and invoke custom tools or Model Context Protocol (MCP) servers.

Zero external microservices or Docker dependencies required — grip-sdk is a pure, self-contained Python package tested across Python 3.10, 3.11, 3.12, and 3.13.

Available directly on PyPI as grip-sdk and maintained on GitHub at theshoaibme/grip-sdk.

Installation

pip install grip-sdk

Quick start

Instantiate the synchronous Grip client and run an AI search query with citation grounding:

from grip import Grip

client = Grip()
response = client.search.query("What are the latest breakthroughs in fusion energy?")

print("Answer:", response.answer)
print("\nSources:")
for src in response.sources:
    print(f"- {src.title}: {src.link}")

Token streaming & reasoning

Stream tokens directly as they are generated, including deep reasoning and thinking events:

from grip import Grip

client = Grip()

for chunk in client.search.stream("Explain quantum entanglement for beginners"):
    if chunk.event == "thinking":
        print(f"[Thinking]: {chunk.thinking}")
    elif chunk.event == "delta":
        print(chunk.delta, end="", flush=True)
    elif chunk.event == "done":
        print("\n[Complete]")

Multi-turn conversational sessions

Maintain persistent conversational memory and thread context across consecutive turns:

from grip import Grip

client = Grip()

# Create or resume a session
session = client.sessions.create(title="Physics Assistant")

# First turn
res1 = session.ask("What is dark matter?")
print(res1.answer)

# Follow-up turn retains context
res2 = session.ask("How do scientists try to detect it?")
print(res2.answer)

# List historical turns
history = session.get_history()
print(f"Total turns in session: {len(history)}")

Asynchronous client (AsyncGrip)

For asynchronous workflows in FastAPI, asyncio, or agent loops, use AsyncGrip:

import asyncio
from grip import AsyncGrip

async def main():
    async with AsyncGrip() as client:
        # Async query
        res = await client.search.query("What is asyncio in Python?")
        print(res.answer)

        # Async streaming
        async for chunk in client.search.stream("Explain event loops"):
            if chunk.event == "delta":
                print(chunk.delta, end="", flush=True)

asyncio.run(main())

Dynamic multi-provider search

grip-sdk provides automatic routing and dynamic dispatch across multiple providers without code changes:

  • google / google_ai — Google AI Mode stealth browser automation
  • openai — OpenAI AI search integration
  • chatgpt_web — ChatGPT web interface provider with reasoning models
  • gemini_web — Gemini web interface provider
  • grip / grip_ai — Grip AI native intelligent auto-router
# Target specific provider or let Grip auto-route
client = Grip(provider="google_ai")
res = client.search.query("Latest NASA missions")

Agentic tools & MCP integration

Build agentic workflows with custom tool registration, behavioral rules, and external Model Context Protocol (MCP) servers:

from grip import Grip
from grip.agent import Agent

client = Grip()
agent = Agent(client=client)

# Connect an external MCP server via stdio
agent.connect_mcp(command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"])

# Execute agent run with reasoning and tools
result = agent.run("Analyze the latest dataset and summarize key takeaways")
print(result.output)