Authentication

API Key Authentication

The simplest way to authenticate is with API keys.

Environment Variables

# Required
OBSERVEE_API_KEY=obs_your_api_key_here

# Choose your LLM provider
ANTHROPIC_API_KEY=your_anthropic_key_here
OPENAI_API_KEY=your_openai_key_here
GOOGLE_API_KEY=your_gemini_key_here

Function Parameters

from observee_agents import chat_with_tools

result = chat_with_tools(
    message="Hello",
    provider="anthropic",
    observee_api_key="obs_your_key_here"
)

OAuth Authentication

For tools that require OAuth (Gmail, Slack, etc.), use the built-in authentication flows.

Available Services

Gmail, Google Calendar, Google Docs, Google Drive, Google Sheets, Slack, Notion, Linear, Asana, Outlook, OneDrive, Atlassian, Supabase, Airtable, Discord, and more.

Start Authentication Flow

from observee_agents import call_mcpauth_login, get_available_servers

# See available services
servers = get_available_servers()
print(f"Available: {servers['supported_servers']}")

# Start authentication for Gmail
response = call_mcpauth_login(auth_server="gmail")
print(f"Visit: {response['url']}")

# Start authentication for Slack
response = call_mcpauth_login(auth_server="slack")
print(f"Visit: {response['url']}")

Using Authenticated Tools

Once authenticated, tools will automatically use your credentials:

# This will use your authenticated Gmail account
result = chat_with_tools(
    message="Check my Gmail inbox and summarize important emails",
    provider="anthropic"
)

Configuration Options

Custom Server URL

result = chat_with_tools(
    message="Hello",
    observee_url="https://your-custom-server.com/mcp",
    client_id="your_client_id"
)

Priority Order

Authentication uses this priority:

  1. Function parameters (observee_api_key, observee_url)
  2. Environment variables (OBSERVEE_API_KEY, OBSERVEE_URL)
  3. Default values

Security Best Practices

  • Never commit API keys to version control
  • Use environment variables in production
  • Rotate API keys regularly
  • Use .env files for development only

Troubleshooting

Invalid API Key: Check your key starts with obs_

OAuth Failed: Make sure you completed the authentication flow

Permission Denied: Check your account has access to the requested service

Next Steps