Skip to main content

Sec-Gemini Python SDK

Python SDK, terminal client, MCP server, and BYOT tunnel for the Sec-Gemini security AI agent.

Install

pip install sec-gemini

Set your API key

Get an API key from secgemini.google/keys, then:

sec-gemini set-key

What's included

  • Terminal UI (sec-gemini) -- interactive chat with the agent
  • Python SDK -- async client for programmatic access
  • MCP server (sec-gemini-mcp) -- expose the SDK to AI assistants
  • BYOT client (sec-gemini-byot) -- connect local tools to the cloud agent
  • 35 baseline tools in 5 categories: file operations, shell, Python execution, JavaScript execution, and network analysis

Quick start

Terminal UI -- interactive chat with the agent:

# Standard launch
sec-gemini

# Launch with local MCP scripts (BYOT "magic" mode)
sec-gemini --mcp ./my_tools.py

Tip: Local scripts passed via --mcp appear in the "Bring Your Own MCP" section and are automatically functional in new sessions. Requires fastmcp installed.

Python SDK -- programmatic access:

import asyncio
from sec_gemini.services.backend import Backend

async def main():
    backend = Backend(api_key="YOUR_KEY")
    await backend.connect()
    session = await backend.create_session()
    await backend.send_prompt(session.session_id, "Analyze example.com")
    async for msg in backend.stream_messages(session.session_id):
        print(f"[{msg.message_type}] {msg.content[:200]}")
    await backend.close()

asyncio.run(main())

MCP server -- expose the SDK to AI assistants (Claude Code, Gemini CLI):

sec-gemini-mcp

BYOT -- connect local tools to the cloud agent:

# Minimal: connect with base local tools (enabled by default)
uvx --from sec-gemini sec-gemini-byot

# Connect additional MCPs and local skills
uvx --from sec-gemini sec-gemini-byot --mcp ./my_tools.py --skills ./my_skill.md

Security notice: BYOT base tools (shell, file, Python, JavaScript) run directly on your machine with no sandboxing. Run inside a container or VM. See the BYOT Guide for details.

Documentation

Full documentation, guides, and API reference: secgemini.google

Requirements

  • Python 3.12+
  • uv (recommended for development)

License

Internal -- see repository root for license details.

Release files for sec-gemini 3.4.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sec-gemini 3.4.11
File Size Uploaded
sec_gemini-3.4.11.tar.gz 237.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sec-gemini 3.4.11
File Interpreter ABI Platform
sec_gemini-3.4.11-py3-none-any.whl Python 3 none any Details

Total release size: 547.6 kB

Release files / sec_gemini-3.4.11.tar.gz

Download URL sec_gemini-3.4.11.tar.gz
Size 237.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3d87b1a23604f694b9add2b0b81ca06ecdfe15e7965a12f56416a9118345663b
BLAKE2b-256 checksum
How to use checksums
158ae87f74889e858d2e00b4d70aae7677b78ed64a15adfdd0825859b2491fae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / sec_gemini-3.4.11-py3-none-any.whl

Download URL sec_gemini-3.4.11-py3-none-any.whl
Size 310.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad74a863c8f71e09e6a34fe8ce61aca795278fb15052cdf964ada9d0b9581e34
BLAKE2b-256 checksum
How to use checksums
9f5cb1768c5c26c4e540e320b1953241587f92886b04a7c520fcd03b24e29d6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

3.4.12

2 release files

This release

3.4.11 This release

2 release files

3.4.10

2 release files

3.4.9

2 release files

3.4.8

2 release files

3.4.7

2 release files

3.4.6

2 release files

3.4.5

2 release files

3.4.4

2 release files

3.4.2

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.1

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page