# How to integrate Sap successfactors MCP with Pydantic AI

```json
{
  "title": "How to integrate Sap successfactors MCP with Pydantic AI",
  "toolkit": "Sap successfactors",
  "toolkit_slug": "sap_successfactors",
  "framework": "Pydantic AI",
  "framework_slug": "pydantic-ai",
  "url": "https://composio.dev/toolkits/sap_successfactors/framework/pydantic-ai",
  "markdown_url": "https://composio.dev/toolkits/sap_successfactors/framework/pydantic-ai.md",
  "updated_at": "2026-05-12T10:24:40.837Z"
}
```

## Introduction

This guide walks you through connecting Sap successfactors to Pydantic AI using the Composio tool router. By the end, you'll have a working Sap successfactors agent that can show your current employee profile details, check your job title and department info, display your contact information in successfactors through natural language commands.
This guide will help you understand how to give your Pydantic AI agent real control over a Sap successfactors account through Composio's Sap successfactors MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Sap successfactors with

- [ChatGPT](https://composio.dev/toolkits/sap_successfactors/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/sap_successfactors/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/sap_successfactors/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/sap_successfactors/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/sap_successfactors/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/sap_successfactors/framework/codex)
- [Cursor](https://composio.dev/toolkits/sap_successfactors/framework/cursor)
- [VS Code](https://composio.dev/toolkits/sap_successfactors/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/sap_successfactors/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/sap_successfactors/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/sap_successfactors/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/sap_successfactors/framework/cli)
- [Google ADK](https://composio.dev/toolkits/sap_successfactors/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/sap_successfactors/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/sap_successfactors/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/sap_successfactors/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/sap_successfactors/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/sap_successfactors/framework/crew-ai)

## 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 Sap successfactors
- 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 Sap successfactors 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 Sap successfactors MCP server, and what's possible with it?

The Sap successfactors MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Sap successfactors account. It provides structured and secure access to your HR data, so your agent can retrieve user information, access employee details, and drive workforce automation on your behalf.
- Current user profile retrieval: Instantly fetch the authenticated user's profile and access up-to-date information about their SAP SuccessFactors account.
- Employee data access: Allow your agent to securely obtain details about employees, enabling streamlined HR and workforce management workflows.
- Personalized onboarding support: Use user data to personalize onboarding experiences, helping new hires get up to speed faster with relevant, contextual information.
- Automated reporting: Enable your agent to pull user-related reports or summaries, supporting HR analytics and decision-making.
- Seamless integration with enterprise HR processes: Connect user data to other HR tools or workflows, making it easier to automate tasks like leave approvals or performance tracking.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `SAP_SUCCESSFACTORS_APPROVE_CALIBRATION_SESSION` | Approve Calibration Session | Finalize a calibration session that is in the In Progress or Approving status. |
| `SAP_SUCCESSFACTORS_CREATE_A_FEEDBACK_REQUEST` | Create a Feedback Request | Create a feedback request in SAP SuccessFactors Continuous Feedback. Use when you need to request performance feedback from one employee about another. At least one question must be provided. |
| `SAP_SUCCESSFACTORS_CREATE_LEARNING_ACTIVITIES_BULK` | Create Learning Activities Bulk | Create learning activities and associate them with development goals in bulk (requires third-party LMS integration). |
| `SAP_SUCCESSFACTORS_CREATE_ONBOARDEE` | Create Onboardee | Creates a new onboardee in SAP SuccessFactors Onboarding 2.0 system. Use when initiating the onboarding process for a new hire or rehire. Requires admin create user permissions. |
| `SAP_SUCCESSFACTORS_CREATE_UPDATE_SUCCESSOR_NOMINATION` | Create or Update Successor Nomination | Create or update a successor nomination for a position or talent pool in succession planning. Use when you need to nominate or update a successor for a specific position or talent pool. |
| `SAP_SUCCESSFACTORS_DELETE_NOMINATION_POSITION_TALENT_POOL` | Delete Nomination | Delete a nomination for a position or talent pool in succession planning. Use when you need to remove a nominee from a position or talent pool nomination. |
| `SAP_SUCCESSFACTORS_GET_APPLICATION_INTERVIEW` | Get Application Interview | Retrieves interview information related to job applications from Interview Central. Use when you need to query interview schedules, statuses, or details for applicants. Note: This entity checks only the first 1000 records, so filtering by applicationId is recommended. |
| `SAP_SUCCESSFACTORS_GET_BACKGROUND_EDUCATION` | Get Background Education | Tool to retrieve background education records for employees from SAP SuccessFactors. Use when you need to query education history with support for filtering, field selection, and pagination via OData query options. Background entities use backgroundElementId as the unique key field. |
| `SAP_SUCCESSFACTORS_GET_BACKGROUND_MOBILITY` | Get Background Mobility | Retrieves mobility background records showing employee willingness to relocate. Use when you need to query employee geographic mobility preferences and location data. Results can be filtered and ordered by bgOrderPos to maintain screen display order. |
| `SAP_SUCCESSFACTORS_GET_CALIBRATION_SESSION_BY_ID` | Get Calibration Session By ID | Get a specific calibration session by session ID. |
| `SAP_SUCCESSFACTORS_GET_CALIBRATION_SESSIONS` | Get Calibration Sessions | Query all the calibration sessions that a user can access. |
| `SAP_SUCCESSFACTORS_GET_CALIBRATION_SUBJECT_BY_ID` | Get Calibration Subject By ID | Query a specific subject's competency ratings and ratings within a calibration session. |
| `SAP_SUCCESSFACTORS_GET_CALIBRATION_SUBJECT_RATINGS` | Get Calibration Subject Ratings | Query a subject's ratings, competency ratings, and comments by using session ID. |
| `SAP_SUCCESSFACTORS_GET_CDP_LEARNING_METADATA` | Get CDP Learning Metadata | Get metadata for Career Development Planning Learning service. |
| `SAP_SUCCESSFACTORS_GET_CURRENT_USER` | Get Current User | Retrieves the currently authenticated user's information from SAP SuccessFactors. |
| `SAP_SUCCESSFACTORS_GET_CUSTOM_MDF_OBJECT` | Get Custom MDF Object | Tool to retrieve custom MDF (Metadata Framework) objects from SAP SuccessFactors. Custom object names begin with cust_ prefix in the API. Use when you need to query custom business objects defined in the MDF framework. |
| `SAP_SUCCESSFACTORS_GET_EMP_EMPLOYMENT_TERMINATION` | Get Employee Employment Termination | Retrieves employee termination information records from SAP SuccessFactors. Contains details about employment terminations including termination date and reason. Use when you need to query termination records with support for filtering, field selection, expansion of related entities, and pagination via OData query options. |
| `SAP_SUCCESSFACTORS_GET_EMPLOYEE_TIME` | Get Employee Time | Retrieves employee time entries including time off records from SAP SuccessFactors. Use when you need to query approved leaves, time-off requests, or employee time tracking data. Supports filtering by userId, approvalStatus, timeType, and date ranges. |
| `SAP_SUCCESSFACTORS_GET_EMPLOYEE_TIMESHEET` | Get Employee Timesheet | Retrieves employee timesheet records for attendances, overtime, on-call times, and allowances. Use when you need to query employee timesheet data from SAP SuccessFactors. |
| `SAP_SUCCESSFACTORS_GET_EMP_PAY_COMP_NON_RECURRING` | Get Non-Recurring Pay Components | Tool to retrieve non-recurring pay component information including bonuses and one-time payments from SAP SuccessFactors. Use when you need data about employee bonuses, commissions, or other non-recurring compensation components. |
| `SAP_SUCCESSFACTORS_GET_EMP_PAY_COMP_RECURRING` | Get Recurring Pay Components | Tool to retrieve recurring pay component information including salary and benefits data from SAP SuccessFactors. Use when you need to query employee compensation data with recurring payments such as salary, allowances, or benefits. Supports filtering by userId and payComponent code. |
| `SAP_SUCCESSFACTORS_GET_FEEDBACK_RECORDS_SERVICE_AVAILABLE` | Get Feedback Records | Tool to retrieve continuous feedback records from SAP SuccessFactors Performance and Goals module using OData V4 protocol. Use when you need to query and retrieve feedback data with filtering, sorting, pagination, and field selection capabilities. Supports standard OData v4 query operations for flexible data retrieval. |
| `SAP_SUCCESSFACTORS_GET_FO_BUSINESS_UNIT` | Get FOBusinessUnit | Retrieves foundation object business unit records for organizational structure hierarchy. Use when querying business unit information with support for filtering, sorting, and pagination. |
| `SAP_SUCCESSFACTORS_GET_FO_COMPANY` | Get FOCompany Records | Retrieves foundation object company records from SAP SuccessFactors. Returns company information including display_name, legal_name, and entityOID for One Domain Model integration. |
| `SAP_SUCCESSFACTORS_GET_FO_COST_CENTER` | Get Foundation Object Cost Centers | Retrieves foundation object cost center records for organizational structure. Contains cost center information with entityOID for One Domain Model integration. Use standard OData query parameters to filter, sort, and paginate results. |
| `SAP_SUCCESSFACTORS_GET_FO_DEPARTMENT` | Get FODepartment Records | Tool to retrieve foundation object department records from SAP SuccessFactors. Use when you need to access organizational department structure information including team and group details. |
| `SAP_SUCCESSFACTORS_GET_FO_JOB_CODE` | Get Foundation Object Job Codes | Retrieves foundation object job code records containing job classification information. Use when you need to fetch job codes with their associated metadata for positions. |
| `SAP_SUCCESSFACTORS_GET_FO_JOB_FUNCTION` | Get Job Functions | Tool to retrieve foundation object job function records for categorizing job roles. Use when you need to query job function data with support for filtering, field selection, and pagination via OData query options. |
| `SAP_SUCCESSFACTORS_GET_FO_LOCATION` | Get Foundation Object Location | Tool to retrieve foundation object location records for work locations. Use when you need to query organizational location data including names, status, timezones, and address details. |
| `SAP_SUCCESSFACTORS_GET_FO_PAY_GROUP` | Get FOPayGroup | Retrieves foundation object pay group records for compensation and payroll groupings. Use when querying pay group data from SAP SuccessFactors. |
| `SAP_SUCCESSFACTORS_GET_FORM_CONTENT` | Get Form Content | Retrieves performance form content from SAP SuccessFactors. Use to query forms with filters like form template ID or modification date. |
| `SAP_SUCCESSFACTORS_GET_GOAL_PLAN_TEMPLATE` | Get Goal Plan Template | Retrieves goal plan template information from SAP SuccessFactors. Use when you need to fetch goal plan template configurations that define the structure of goals via DTD file. |
| `SAP_SUCCESSFACTORS_GET_GOALS_BY_PLAN` | Get Goals By Plan | Retrieves performance goals data using the goal plan ID. Use this to query goals for a specific plan (e.g., Goal_11) with optional filtering by userId or other fields. |
| `SAP_SUCCESSFACTORS_GET_INTERVIEW_OVERALL_ASSESSMENT` | Get Interview Overall Assessment | Tool to retrieve overall interview ratings and navigation for assessments from Interview Central. Use when you need to fetch overall interview assessment data including ratings, recommendations, and comments. |
| `SAP_SUCCESSFACTORS_GET_JOB_APPLICATION` | Get Job Application | Retrieves job application records linking candidates to job requisitions. Use when you need to query application data, filter by status, or retrieve candidate application information. |
| `SAP_SUCCESSFACTORS_GET_JOB_REQ_SCREENING_QUESTION` | Get Job Requisition Screening Questions | Tool to retrieve screening questions related to job requisitions from SAP SuccessFactors Recruiting. Use when you need to access screening questions for candidate assessment in the recruitment process. |
| `SAP_SUCCESSFACTORS_GET_JOB_REQUISITION` | Get Job Requisition | Tool to retrieve job requisition records from SAP SuccessFactors Recruiting Management. Use when you need to read job requisitions, send them to third-party systems, or manage the recruiting workflow. |
| `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_CALIB_SESSION_SERVICE` | Get Calibration Session Metadata | Get OData metadata for Calibration Session service. Returns the service metadata including available entity sets. Use this to discover available entities in the CalSession.svc service. |
| `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_CLOCK_INCLOCK_OUT` | Get Clock In/Out Integration Metadata | Get OData metadata for Clock In/Clock Out Integration service. Returns the complete service schema including entity types, enum types, complex types, and entity container definitions. |
| `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_FOR_NOMINATION_SERVICE` | Get Nomination Service Metadata | Get OData metadata for Nomination service. Returns the service metadata including available entity sets for successor and talent pool nominations. Use this to discover available entities in the NominationService.svc service. |
| `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_ONBOARDING_ADDL` | Get Onboarding Additional Services Metadata | Get OData metadata for Onboarding Additional Services. Returns the complete service schema including available operations like updateUserNamePostHiring and getUserNameOfNewlyHiredEmployee. |
| `SAP_SUCCESSFACTORS_GET_ODATA_USER_METADATA` | Get User Entity Metadata | Retrieves the OData metadata document for the User entity describing its properties and operations. Use this to discover available fields, data types, and navigation properties for the User entity. |
| `SAP_SUCCESSFACTORS_GET_ONB2_PROCESS` | Get Onboarding 2.0 Processes | Tool to retrieve Onboarding 2.0 process records for new hires from SAP SuccessFactors using OData V2 protocol. Use when you need to query onboarding workflow information with filtering, sorting, and field selection capabilities. |
| `SAP_SUCCESSFACTORS_GET_PENDING_FEEDBACK_REQUESTS_FEEDBACK` | Get Pending Feedback Requests | Tool to retrieve pending feedback requests or feedback request records from SAP SuccessFactors Continuous Feedback. Use when you need to query feedback requests with filtering, sorting, pagination, and field selection capabilities. Supports standard OData v4 query operations for flexible data retrieval. |
| `SAP_SUCCESSFACTORS_GET_PER_PERSONAL` | Get Personal Information Records | Tool to retrieve personal information records from SAP SuccessFactors Employee Central. The PerPersonal entity contains non-effective-dated biographical information, emergency contacts, social media accounts, and email addresses. Use when you need to access personal information data. |
| `SAP_SUCCESSFACTORS_GET_PER_PERSON_BY_ID` | Get Person by ID | Tool to retrieve person information for an employee by their external person ID. Use when you need to access core personal information data from SAP SuccessFactors Employee Central PerPerson entity. |
| `SAP_SUCCESSFACTORS_GET_PICKLIST` | Get Picklist | Tool to retrieve picklist definitions from SAP SuccessFactors. Use when you need to fetch selectable value lists (picklists) that are used across various SuccessFactors entities. |
| `SAP_SUCCESSFACTORS_GET_PICKLIST_OPTION` | Get Picklist Option | Retrieves picklist option values with localized labels from SAP SuccessFactors. Use the localeLabel property to get text in the locale of the logged-in user. Supports OData query parameters for filtering, selection, and pagination. |
| `SAP_SUCCESSFACTORS_GET_POSITION` | Get Position | Retrieves position management records from SAP SuccessFactors Employee Central. Use when you need to query position structure and hierarchy information. |
| `SAP_SUCCESSFACTORS_GET_TALENT_POOL` | Get Talent Pool | Retrieves talent pool records including members and nomination details. Use when you need to access talent pool information for succession planning. |
| `SAP_SUCCESSFACTORS_GET_TEMPORARY_TIME_INFORMATION` | Get Temporary Time Information | Retrieves temporary time information records from Time Management module. Use when you need to query temporary work schedules assigned to employees. |
| `SAP_SUCCESSFACTORS_GET_TIME_ACCOUNT_SNAPSHOT` | Get Time Account Snapshot | Retrieves time account snapshot data for leave liability calculation and payroll. Use when you need balance information for employee time accounts as of a specific point in time. |
| `SAP_SUCCESSFACTORS_GET_WORK_ORDER` | Get Work Order | Tool to retrieve work order records for contingent worker management from SAP SuccessFactors. Use when you need to query work order information with support for filtering, field selection, and pagination via OData query options. |
| `SAP_SUCCESSFACTORS_GIVE_OR_RESPOND_FEEDBACK` | Give Feedback or Respond to Feedback Request | Tool to give performance feedback or respond to a feedback request in SAP SuccessFactors Continuous Performance Management. Use when you need to provide feedback on employee performance, strengths, development areas, or respond to existing feedback requests. Supports up to 3 question-answer pairs with extended field lengths (4000 characters per answer). |
| `SAP_SUCCESSFACTORS_LIST_CANDIDATES` | List Candidates | Tool to retrieve a list of candidates from SAP SuccessFactors. Use when you need to query candidate data with OData filtering and pagination options. |
| `SAP_SUCCESSFACTORS_LIST_EMP_EMPLOYMENT` | List Employee Employment Records | Tool to retrieve a list of all employment records from SAP SuccessFactors. Use when you need to query employment data including start dates, employment types, and assignment classes. Supports filtering by custom string fields (custom-string1, custom-string2, custom-string3) and userId. |
| `SAP_SUCCESSFACTORS_LIST_PER_PERSON` | List Person Records | Tool to retrieve a list of person records from SAP SuccessFactors Employee Central. Use when you need to query employee personal information. The PerPerson entity is the foundation for all employee data in Employee Central and always returns the latest active record for each person. |
| `SAP_SUCCESSFACTORS_LIST_USERS` | List Users | Tool to retrieve a list of all employee users from SAP SuccessFactors. Use when you need to query user information with support for filtering, field selection, and pagination via OData query options. |
| `SAP_SUCCESSFACTORS_QUERY_ALL_AVAILABLE_CLOCK_CLOCK_OUT` | Query All Available Clock In/Clock Out Groups | Query all available clock in/clock out groups. Use when you need to retrieve a list of all clock in/clock out groups configured in SAP SuccessFactors. |
| `SAP_SUCCESSFACTORS_QUERY_CLOCK_CLOCK_OUT_GROUP_CODE_TIME` | Query Clock In/Clock Out Group By Code | Query a clock in/clock out group by code with time event types. Use when you need to retrieve details of a specific Clock In Clock Out Group including its configuration and optionally related Time Event Types. |
| `SAP_SUCCESSFACTORS_REFRESH_CDP_LEARNING_METADATA` | Refresh CDP Learning Metadata | Refresh metadata for Career Development Planning Learning service. |
| `SAP_SUCCESSFACTORS_REFRESH_METADATA_CONT_FEEDBACK_SERVICE` | Refresh Metadata for Continuous Feedback | Refresh metadata cache for Continuous Feedback service. Use when metadata changes need to be applied without service interruption. |
| `SAP_SUCCESSFACTORS_UPDATE_CALIBRATION_SUBJECT_RATINGS` | Update Calibration Subject Ratings | Update a subject's competency ratings in a calibration session. |
| `SAP_SUCCESSFACTORS_UPDATE_INTERNAL_USERNAME_NEW_HIRES_AFTER` | Update Username Post Hiring | Update the internal username of new hires after hiring process is completed from Active Directory. Use after Manage Pending Hire (MPH) submit and before day 1 (pre-conversion). Requires 'Manage Onboarding 2.0 or Offboarding 2.0 Update New Hire Data for External HRIS' permission. |

## Supported Triggers

None listed.

## Creating MCP Server - Stand-alone vs Composio SDK

The Sap successfactors MCP server is an implementation of the Model Context Protocol that connects your AI agent to Sap successfactors. It provides structured and secure access so your agent can perform Sap successfactors operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 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

### 1. Getting API Keys for OpenAI and Composio

OpenAI API Key
- Go to the [OpenAI dashboard](https://platform.openai.com/settings/organization/api-keys) 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](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Navigate to your API settings and generate a new API key.
- Store this key securely as you'll need it for authentication.

### 2. Install dependencies

Install the required libraries.
What's happening:
- composio connects your agent to external SaaS tools like Sap successfactors
- pydantic-ai lets you create structured AI agents with tool support
- python-dotenv loads your environment variables securely from a .env file
```bash
pip install composio pydantic-ai python-dotenv
```

### 3. Set up environment variables

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
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
OPENAI_API_KEY=your_openai_api_key
```

### 4. Import dependencies

What's happening:
- We load environment variables and import required modules
- Composio manages connections to Sap successfactors
- MCPServerStreamableHTTP connects to the Sap successfactors MCP server endpoint
- Agent from Pydantic AI lets you define and run the AI assistant
```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()
```

### 5. Create a Tool Router Session

What's happening:
- We're creating a Tool Router session that gives your agent access to Sap successfactors 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
```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 Sap successfactors
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["sap_successfactors"],
    )
    url = session.mcp.url
    if not url:
        raise ValueError("Composio session did not return an MCP URL")
```

### 6. Initialize the Pydantic AI Agent

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

### 7. Build the chat interface

What's happening:
- The agent reads input from the terminal and streams its response
- Sap successfactors API calls happen automatically under the hood
- The model keeps conversation history to maintain context across turns
```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 Sap successfactors.\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()
```

### 8. Run the application

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

## Complete Code

```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 Sap successfactors
    composio = Composio(api_key=api_key)
    session = composio.create(
        user_id=user_id,
        toolkits=["sap_successfactors"],
    )
    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
    sap_successfactors_mcp = MCPServerStreamableHTTP(url, headers={"x-api-key": COMPOSIO_API_KEY})
    agent = Agent(
        "openai:gpt-5",
        toolsets=[sap_successfactors_mcp],
        instructions=(
            "You are a Sap successfactors assistant. Use Sap successfactors 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 Sap successfactors.\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 Sap successfactors through Composio's Tool Router. With this setup, your agent can perform real Sap successfactors 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 + Sap successfactors for workflow automation)
This architecture makes your AI agent "agent-native", able to securely use APIs in a unified, composable way without custom integrations.

## How to build Sap successfactors MCP Agent with another framework

- [ChatGPT](https://composio.dev/toolkits/sap_successfactors/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/sap_successfactors/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/sap_successfactors/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/sap_successfactors/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/sap_successfactors/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/sap_successfactors/framework/codex)
- [Cursor](https://composio.dev/toolkits/sap_successfactors/framework/cursor)
- [VS Code](https://composio.dev/toolkits/sap_successfactors/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/sap_successfactors/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/sap_successfactors/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/sap_successfactors/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/sap_successfactors/framework/cli)
- [Google ADK](https://composio.dev/toolkits/sap_successfactors/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/sap_successfactors/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/sap_successfactors/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/sap_successfactors/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/sap_successfactors/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/sap_successfactors/framework/crew-ai)

## Related Toolkits

- [Ashby](https://composio.dev/toolkits/ashby) - Ashby is an applicant tracking system that handles job postings, candidate management, and hiring analytics.
- [Async interview](https://composio.dev/toolkits/async_interview) - Async interview is an on-demand video interview platform for streamlined hiring. Candidates record responses on their schedule, so employers can review anytime.
- [Bamboohr](https://composio.dev/toolkits/bamboohr) - BambooHR is a cloud-based HR management platform for small and mid-sized businesses. It streamlines employee data, HR workflows, and reporting in one easy interface.
- [Breathe HR](https://composio.dev/toolkits/breathehr) - Breathe HR is cloud-based HR software for SMEs to manage employee data, absences, and performance. It simplifies HR admin, making it easy to keep employee records accurate and up to date.
- [Connecteam](https://composio.dev/toolkits/connecteam) - Connecteam is a workforce management platform for deskless teams, streamlining operations, HR, and team communication. It helps businesses save time by automating scheduling, time tracking, and staff engagement tasks.
- [Lever](https://composio.dev/toolkits/lever) - Lever is an applicant tracking system that blends sourcing, CRM, and analytics for recruiting. It helps companies scale hiring with collaborative workflows and actionable insights.
- [Recruitee](https://composio.dev/toolkits/recruitee) - Recruitee is collaborative hiring software that centralizes recruitment tasks for teams. It streamlines sourcing, interviewing, and hiring so you can fill roles faster.
- [Remote retrieval](https://composio.dev/toolkits/remote_retrieval) - Remote retrieval is a logistics automation tool for managing laptop and monitor returns. It streamlines return tracking, saving time and hassle for IT and ops teams.
- [Talenthr](https://composio.dev/toolkits/talenthr) - TalentHR is an intuitive, all-in-one HR tool for managing employee records, leave, and HR workflows. It streamlines HR operations so businesses can focus on people, not paperwork.
- [Workable](https://composio.dev/toolkits/workable) - 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.
- [Workday](https://composio.dev/toolkits/workday) - Workday is a cloud-based ERP platform for HR, finance, and workforce analytics. It streamlines employee management, payroll, and business operations in a single system.
- [Gmail](https://composio.dev/toolkits/gmail) - Gmail is Google's email service with powerful spam protection, search, and G Suite integration. It keeps your inbox organized and makes communication fast and reliable.
- [Google Calendar](https://composio.dev/toolkits/googlecalendar) - Google Calendar is a time management service for scheduling meetings, events, and reminders. It streamlines personal and team organization with integrated notifications and sharing options.
- [Google Drive](https://composio.dev/toolkits/googledrive) - Google Drive is a cloud storage platform for uploading, sharing, and collaborating on files. It's perfect for keeping your documents accessible and organized across devices.
- [Outlook](https://composio.dev/toolkits/outlook) - Outlook is Microsoft's email and calendaring platform for unified communications and scheduling. It helps users stay organized with powerful email, contacts, and calendar management.
- [Twitter](https://composio.dev/toolkits/twitter) - Twitter is a social media platform for sharing real-time updates, conversations, and news. Stay connected, informed, and engaged with communities worldwide.
- [Google Sheets](https://composio.dev/toolkits/googlesheets) - Google Sheets is a cloud-based spreadsheet tool for real-time collaboration and data analysis. It lets teams work together from anywhere, updating information instantly.
- [Supabase](https://composio.dev/toolkits/supabase) - Supabase is an open-source backend platform offering scalable Postgres databases, authentication, storage, and real-time APIs. It lets developers build modern apps without managing infrastructure.
- [Composio](https://composio.dev/toolkits/composio) - Composio is an integration platform that connects AI agents with hundreds of business tools. It streamlines authentication and lets you trigger actions across services—no custom code needed.
- [Notion](https://composio.dev/toolkits/notion) - Notion is a collaborative workspace for notes, docs, wikis, and tasks. It streamlines team knowledge, project tracking, and workflow customization in one place.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Sap successfactors MCP?

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

### Can I use Tool Router MCP with Pydantic AI?

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 Sap successfactors tools.

### Can I manage the permissions and scopes for Sap successfactors while using Tool Router?

Yes, absolutely. You can configure which Sap successfactors 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.

### How safe is my data with Composio Tool Router?

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 Sap successfactors data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
