Skip to main content

Scalar Agent SDK - Connect your AI agent to Scalar's OpenAPI MCP servers

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scalar_agent-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scalar_agent-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file scalar_agent-0.1.1.tar.gz.

File metadata

  • Download URL: scalar_agent-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for scalar_agent-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cd273b526797bc1e7ee06682918440971e649eb7d1c25654cf2bacd10822487f
MD5 d2cbeac457c10cdbd1889454878d76bd
BLAKE2b-256 922cf26fc60720a18f97ac14e243f3cd1913e2d605f3502a621b852fc46c81ae

See more details on using hashes here.

File details

Details for the file scalar_agent-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: scalar_agent-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for scalar_agent-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a5a2ce4d0cc9082a0e41a5a2a12e528bc0cb4c4e012b05eff0be847ba205d6d
MD5 b852b698b098f337c7e53ee67fa15439
BLAKE2b-256 dcf8b4bcd34aa90e8fe19029b16d2ec83cc2f9b54c8e0978c26006733a1d673a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page