Skip to main content

Scalar Agent SDK (Python)

Connect your AI agent to Scalar's OpenAPI MCP servers. Provides native integrations for the OpenAI Agents SDK and Anthropic Claude Agent SDK.

Installation

pip install scalar-agent

With provider extras:

# For Anthropic
pip install "scalar-agent[anthropic]"

# For OpenAI
pip install "scalar-agent[openai]"

# Both
pip install "scalar-agent[all]"

Setup

from scalar_agent import agent_scalar

scalar = agent_scalar(token="your-personal-token")
installation = scalar.installation("your-installation-id")

Providers

OpenAI Agents SDK

Returns params for MCPServerStreamableHttp from openai-agents. The agent runtime handles tool discovery and execution natively.

import asyncio

from scalar_agent import agent_scalar
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main() -> None:
    scalar = agent_scalar(token="your-personal-token")
    installation = scalar.installation("your-installation-id")

    server = MCPServerStreamableHttp(**installation.create_openai_mcp())
    await server.connect()

    agent = Agent(name="api-agent", mcp_servers=[server])

    result = await Runner.run(agent, "Which APIs are available that let me create a planet?")
    print(result.final_output)

    await server.cleanup()

asyncio.run(main())

Anthropic Claude Agent SDK

Returns an MCP server configuration for claude_agent_sdk.

import asyncio

from scalar_agent import agent_scalar
from claude_agent_sdk import query
from claude_agent_sdk.types import ClaudeAgentOptions, ResultMessage

scalar = agent_scalar(token="your-personal-token")
installation = scalar.installation("your-installation-id")

async def main() -> None:
    async for message in query(
        prompt="Which APIs are available that let me create a planet?",
        options=ClaudeAgentOptions(
            mcp_servers={"scalar": installation.create_anthropic_mcp()},
            allowed_tools=["mcp__scalar__*"],
        ),
    ):
        if isinstance(message, ResultMessage):
            print(message.result)

asyncio.run(main())

Configuration

Parameter Type Description
token str Your Scalar Personal Token used to authenticate requests to your MCP
base_url str Base URL of the Scalar MCP server. Defaults to the Scalar environment

Release files for scalar-agent 0.1.1

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

Source distribution (sdist)

Source distribution for scalar-agent 0.1.1
File Size Uploaded
scalar_agent-0.1.1.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scalar-agent 0.1.1
File Interpreter ABI Platform
scalar_agent-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / scalar_agent-0.1.1.tar.gz

Download URL scalar_agent-0.1.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cd273b526797bc1e7ee06682918440971e649eb7d1c25654cf2bacd10822487f
BLAKE2b-256 checksum
How to use checksums
922cf26fc60720a18f97ac14e243f3cd1913e2d605f3502a621b852fc46c81ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / scalar_agent-0.1.1-py3-none-any.whl

Download URL scalar_agent-0.1.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a5a2ce4d0cc9082a0e41a5a2a12e528bc0cb4c4e012b05eff0be847ba205d6d
BLAKE2b-256 checksum
How to use checksums
dcf8b4bcd34aa90e8fe19029b16d2ec83cc2f9b54c8e0978c26006733a1d673a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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