Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.egisai.co/llms.txt

Use this file to discover all available pages before exploring further.

The SDK transparently governs calls made through the official anthropic Python package. After egisai.init() runs, both sync and async Anthropic / AsyncAnthropic clients are policy-checked, audited, and (where applicable) sanitized before reaching the provider.

Supported surface

MethodSyncAsyncStreaming
messages.create

Minimum version

anthropic>=0.40 is recommended.

Install

pip install "egisai[anthropic]"

Use

import egisai
import anthropic

egisai.init(app="research-agent", env="production")

client = anthropic.Anthropic()
response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.content[0].text)

Async usage

import asyncio
import egisai
import anthropic

egisai.init(app="async-research-agent", env="production")

async def main():
    client = anthropic.AsyncAnthropic()
    response = await client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Hello!"}],
    )
    print(response.content[0].text)

asyncio.run(main())

Streaming

client = anthropic.Anthropic()

with client.messages.stream(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Tell me a story."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

System prompts and agent identity

Anthropic places the system prompt in a top-level system= argument rather than in the messages list. The SDK reads from there to fingerprint sub-agents correctly. If you want to override identity explicitly, use set_context().

When a call is blocked

By default a blocked call raises PermissionError. Switch modes at init if you’d rather receive a refusal-shaped Message-like object:
egisai.init(..., on_block="stub")

What’s next

OpenAI

Google Gemini