How to integrate Workable MCP with Pydantic AI

This guide walks you through connecting Workable to Pydantic AI using the Composio tool router. By the end, you'll have a working Workable agent that can list all candidates for open roles, show scheduled interviews for this week, fetch all current job postings through natural language commands. This guide will help you understand how to give your Pydantic AI agent real control over a Workable account through Composio's Workable MCP server. Before we dive in, let's take a quick look at the key ideas and tools involved.

Workable logoWorkable
Oauth2Api Key

Workable is an all-in-one HR software platform that streamlines hiring, employee management, and payroll. It helps teams simplify recruiting, onboarding, and staff operations in one place.

37 Tools

Introduction

This guide walks you through connecting Workable to Pydantic AI using the Composio tool router. By the end, you'll have a working Workable agent that can list all candidates for open roles, show scheduled interviews for this week, fetch all current job postings through natural language commands.

This guide will help you understand how to give your Pydantic AI agent real control over a Workable account through Composio's Workable MCP server.

Before we dive in, let's take a quick look at the key ideas and tools involved.

Also integrate Workable with

TL;DR

Here's what you'll learn:
  • How to set up your Composio API key and User ID
  • How to create a Composio Tool Router session for Workable
  • How to attach an MCP Server to a Pydantic AI agent
  • How to stream responses and maintain chat history
  • How to build a simple REPL-style chat interface to test your Workable workflows

What is Pydantic AI?

Pydantic AI is a Python framework for building AI agents with strong typing and validation. It leverages Pydantic's data validation capabilities to create robust, type-safe AI applications.

Key features include:

  • Type Safety: Built on Pydantic for automatic data validation
  • MCP Support: Native support for Model Context Protocol servers
  • Streaming: Built-in support for streaming responses
  • Async First: Designed for async/await patterns

What is the Workable MCP server, and what's possible with it?

The Workable MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Workable account. It provides structured and secure access to your hiring and HR data, so your agent can perform actions like listing jobs, managing candidates, retrieving background check info, and organizing departments on your behalf.

  • Comprehensive candidate management: Instantly retrieve and aggregate candidate data across all jobs, making it easy for your agent to analyze talent pipelines, track applicants, and surface top candidates.
  • Job and account insights: Let your agent list all open roles, access job details, and pull account-wide information to keep your hiring team up-to-date and organized.
  • Automated event and interview scheduling: Fetch all scheduled events, interviews, and meetings so your agent can help coordinate calendars and ensure everyone’s on the same page.
  • Background check integration: Retrieve available background check providers and packages, enabling your agent to streamline compliance and onboarding workflows.
  • Team and department organization: List or delete departments, fetch member rosters, and manage legal entities—helping your agent automate org chart updates and keep your HR records tidy.

What is the Composio tool router, and how does it fit here?

What is Composio SDK?

Composio's Composio SDK helps agents find the right tools for a task at runtime. You can plug in multiple toolkits (like Gmail, HubSpot, and GitHub), and the agent will identify the relevant app and action to complete multi-step workflows. This can reduce token usage and improve the reliability of tool calls. Read more here: Getting started with Composio SDK

The tool router generates a secure MCP URL that your agents can access to perform actions.

How the Composio SDK works

The Composio SDK follows a three-phase workflow:

  1. Discovery: Searches for tools matching your task and returns relevant toolkits with their details.
  2. Authentication: Checks for active connections. If missing, creates an auth config and returns a connection URL via Auth Link.
  3. Execution: Executes the action using the authenticated connection.

Step-by-step Guide

Step by step09 STEPS
1

Prerequisites

Before starting, make sure you have:
  • Python 3.9 or higher
  • A Composio account with an active API key
  • Basic familiarity with Python and async programming
2

Getting API Keys for OpenAI and Composio

OpenAI API Key
  • Go to the OpenAI dashboard and create an API key. You'll need credits to use the models, or you can connect to another model provider.
  • Keep the API key safe.
Composio API Key
  • Log in to the Composio dashboard.
  • Navigate to your API settings and generate a new API key.
  • Store this key securely as you'll need it for authentication.
3

Install dependencies

bash
pip install composio pydantic-ai python-dotenv

Install the required libraries.

What's happening:

  • composio connects your agent to external SaaS tools like Workable
  • pydantic-ai lets you create structured AI agents with tool support
  • python-dotenv loads your environment variables securely from a .env file
4

Set up environment variables

bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
OPENAI_API_KEY=your_openai_api_key

Create a .env file in your project root.

What's happening:

  • COMPOSIO_API_KEY authenticates your agent to Composio's API
  • USER_ID associates your session with your account for secure tool access
  • OPENAI_API_KEY to access OpenAI LLMs
5

Import dependencies

python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP

load_dotenv()
What's happening:
  • We load environment variables and import required modules
  • Composio manages connections to Workable
  • MCPServerStreamableHTTP connects to the Workable MCP server endpoint
  • Agent from Pydantic AI lets you define and run the AI assistant
6

Create a Tool Router Session

python
async def main():
    api_key = os.getenv("COMPOSIO_API_KEY")
    user_id = os.getenv("USER_ID")
    if not api_key or not user_id:
        raise RuntimeError("Set COMPOSIO_API_KEY and USER_ID in your environment")

    # Create a Composio Tool Router session for Workable
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["workable"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")
What's happening:
  • We're creating a Tool Router session that gives your agent access to Workable tools
  • The create method takes the user ID and specifies which toolkits should be available
  • The returned session.mcp.url is the MCP server URL that your agent will use
7

Initialize the Pydantic AI Agent

python
# Attach the MCP server to a Pydantic AI Agent
workable_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
agent = Agent(
    "openai:gpt-5",
    toolsets=[workable_mcp],
    instructions=(
        "You are a Workable assistant. Use Workable tools to help users "
        "with their requests. Ask clarifying questions when needed."
    ),
)
What's happening:
  • The MCP client connects to the Workable endpoint
  • The agent uses GPT-5 to interpret user commands and perform Workable operations
  • The instructions field defines the agent's role and behavior
8

Build the chat interface

python
# Simple REPL with message history
history = []
print("Chat started! Type 'exit' or 'quit' to end.\n")
print("Try asking the agent to help you with Workable.\n")

while True:
    user_input = input("You: ").strip()
    if user_input.lower() in {"exit", "quit", "bye"}:
        print("\nGoodbye!")
        break
    if not user_input:
        continue

    print("\nAgent is thinking...\n", flush=True)

    async with agent.run_stream(user_input, message_history=history) as stream_result:
        collected_text = ""
        async for chunk in stream_result.stream_output():
            text_piece = None
            if isinstance(chunk, str):
                text_piece = chunk
            elif hasattr(chunk, "delta") and isinstance(chunk.delta, str):
                text_piece = chunk.delta
            elif hasattr(chunk, "text"):
                text_piece = chunk.text
            if text_piece:
                collected_text += text_piece
        result = stream_result

    print(f"Agent: {collected_text}\n")
    history = result.all_messages()
What's happening:
  • The agent reads input from the terminal and streams its response
  • Workable API calls happen automatically under the hood
  • The model keeps conversation history to maintain context across turns
9

Run the application

python
if __name__ == "__main__":
    asyncio.run(main())
What's happening:
  • The asyncio loop launches the agent and keeps it running until you exit

Complete Code

Here's the complete code to get you started with Workable and Pydantic AI:

python
import asyncio
import os
from dotenv import load_dotenv
from composio import Composio
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP

load_dotenv()

async def main():
    api_key = os.getenv("COMPOSIO_API_KEY")
    user_id = os.getenv("USER_ID")
    if not api_key or not user_id:
        raise RuntimeError("Set COMPOSIO_API_KEY and USER_ID in your environment")

    # Create a Composio Tool Router session for Workable
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["workable"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")

    # Attach the MCP server to a Pydantic AI Agent
    workable_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
    agent = Agent(
        "openai:gpt-5",
        toolsets=[workable_mcp],
        instructions=(
            "You are a Workable assistant. Use Workable tools to help users "
            "with their requests. Ask clarifying questions when needed."
        ),
    )

    # Simple REPL with message history
    history = []
    print("Chat started! Type 'exit' or 'quit' to end.\n")
    print("Try asking the agent to help you with Workable.\n")

    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit", "bye"}:
            print("\nGoodbye!")
            break
        if not user_input:
            continue

        print("\nAgent is thinking...\n", flush=True)

        async with agent.run_stream(user_input, message_history=history) as stream_result:
            collected_text = ""
            async for chunk in stream_result.stream_output():
                text_piece = None
                if isinstance(chunk, str):
                    text_piece = chunk
                elif hasattr(chunk, "delta") and isinstance(chunk.delta, str):
                    text_piece = chunk.delta
                elif hasattr(chunk, "text"):
                    text_piece = chunk.text
                if text_piece:
                    collected_text += text_piece
            result = stream_result

        print(f"Agent: {collected_text}\n")
        history = result.all_messages()

if __name__ == "__main__":
    asyncio.run(main())

Conclusion

You've built a Pydantic AI agent that can interact with Workable through Composio's Tool Router. With this setup, your agent can perform real Workable actions through natural language. You can extend this further by:
  • Adding other toolkits like Gmail, HubSpot, or Salesforce
  • Building a web-based chat interface around this agent
  • Using multiple MCP endpoints to enable cross-app workflows (for example, Gmail + Workable for workflow automation)
This architecture makes your AI agent "agent-native", able to securely use APIs in a unified, composable way without custom integrations.
TOOLS

Supported Tools

Every Workable action and event your agent gets out of the box.

Create Employee

Tool to create an employee in your Workable account.

Delete Department

Tool to delete a department.

Delete Subscription

Tool to unsubscribe from an event by deleting a webhook subscription.

Get Account

Tool to return the specified account.

Get Accounts

Retrieves all Workable accounts (organizations) accessible to the authenticated user.

Get Background Check Packages

Tool to retrieve a list of available background check packages from a specified provider.

Get Background Check Providers

Retrieves a list of background check providers integrated with your Workable account.

Get Candidates

Retrieve a list of candidates across all jobs in the organization.

Get Employee

Tool to retrieve detailed information for a specific employee by ID.

Get Events

Retrieve a collection of scheduled events (calls, interviews, meetings) from the Workable account.

Get Jobs

Retrieves a paginated list of jobs from your Workable account.

Get Legal Entities

Tool to retrieve a collection of your account legal entities.

Get Members

Retrieve a paginated list of Workable account members with their roles and permissions.

Get recruiters

Retrieves external recruiters from your Workable account.

Get Requisitions

Tool to retrieve a collection of requisitions in the account.

Get Stages

Tool to retrieve a collection of your recruitment pipeline stages.

Get Subscriptions

Retrieves all webhook subscriptions configured in your Workable account.

List Custom Attributes

Tool to retrieve all custom attributes configured in the Workable account.

List Departments

Tool to retrieve all departments from your Workable account.

List Disqualification Reasons

Tool to retrieve a collection of account's disqualification reasons.

List Employee Fields

Tool to retrieve a collection of your account's employee field definitions.

List Employees

Tool to retrieve a collection of account employees.

List Permission Sets

Tool to retrieve a collection of your account permission sets.

List Public Jobs

Tool to return a collection of public jobs for an account.

List Public Locations

Tool to retrieve a collection of locations where a Workable account has public job postings.

List Time Off Balances

Retrieves all time off balances for an employee across all time off categories.

List Time Off Categories

Tool to retrieve all time off categories configured for your account.

List Work Schedules

Tool to retrieve a collection of work schedules configured in your Workable account.

Update Background Check Status

Updates the status and results of an existing background check in a candidate's timeline.

Merge Department

Tool to merge a department into another.

Create Department

Tool to create a department in your account.

Enable Member

Enable (restore) a deactivated Workable account member to active status.

Invite Member

Tool to invite a member to your Workable account.

Update Department

Tool to update an existing department in your account.

Update Member

Updates a Workable account member's details including roles, name, headline, email, and collaboration rules.

Update Employee

Tool to update an existing employee in Workable.

Upload Employee Documents

Tool to upload a list of documents for a specific employee.

FAQ

Frequently asked questions

With a standalone Workable MCP server, the agents and LLMs can only access a fixed set of Workable tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Workable and many other apps based on the task at hand, all through a single MCP endpoint.

Yes, you can. Pydantic AI fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Workable tools.

Yes, absolutely. You can configure which Workable scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Workable data and credentials are handled as safely as possible.

Start with Workable.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Workable tool your agent needs.Free to start.

Start building