Connect Lever to AI Agents: Orchestrate Job Postings and Sourcing
Give your AI agent Lever tools.
Connecting AI agents to Lever requires handling rate limits, nested object schemas, and pipeline states. This guide shows how to fetch Lever tools dynamically via Truto and orchestrate multi-step hiring workflows.
In this guide
- 01Configure Lever Integration
- 02Fetch Tool Schemas
- 03Bind Tools to the LLM
- 04Implement Rate Limit Handling
- 05Execute the Agent Workflow
The guide
Learn how to connect Lever to AI agents using Truto's /tools endpoint. Build autonomous recruiting workflows with LangChain, CrewAI, and the Vercel AI SDK.
You want to connect Lever to an AI agent so your system can autonomously draft job postings, screen candidate resumes, schedule interviews, and transition opportunities across pipeline stages. Here is exactly how to do it using Truto's /tools endpoint and SDK, bypassing the need to build and maintain a custom Applicant Tracking System (ATS) connector from scratch.
Giving a Large Language Model (LLM) read and write access to your recruiting stack is a high-stakes engineering challenge. If your team uses ChatGPT, check out our guide on connecting Lever to ChatGPT, or if you are building on Anthropic's models, read our guide on connecting Lever to Claude. For developers building custom autonomous workflows, you need a programmatic way to fetch these tools and bind them directly to your agent framework.
This guide breaks down exactly how to fetch AI-ready tools for Lever, bind them natively to an LLM using function calling using frameworks like LangChain, LangGraph, CrewAI, or the Vercel AI SDK, and execute complex talent acquisition workflows. For a deeper dive into the architectural principles of providing APIs to agents, refer to our research on Architecting AI Agents: LangGraph, LangChain, and the SaaS Integration Bottleneck.
The Engineering Reality of the Lever API
Giving an LLM access to an ATS sounds simple during a hackathon. You wrap a standard REST endpoint in an @tool decorator and let the model figure it out. In production, this approach shatters against the idiosyncrasies of enterprise SaaS APIs.
Lever's API introduces specific integration challenges that require strict defensive programming. If you hardcode these interactions into your agent's system prompt, you are forcing the LLM to memorize vendor quirks instead of reasoning about hiring workflows.
The Opportunity vs. Contact Abstraction
Unlike simpler CRMs where a "Person" applies for a "Job", Lever utilizes a deeply nested data model separating Contacts from Opportunities. A Contact is the individual human being. An Opportunity is that individual's specific journey through a pipeline for a specific role.
When an LLM attempts to advance a candidate to the "Offer" stage, it naturally tries to "update the candidate." Lever will reject this. Stages are tied exclusively to Opportunities. Your agent must know to query list_all_lever_opportunities, extract the opportunity_id, and execute a move on that specific entity. Without a unified tool schema guiding the LLM, it will hallucinate API calls against the wrong resource.
Upstream Deprecations and Epoch Timestamps
Lever's API handles time using epoch milliseconds, not standard ISO 8601 strings. Standard LLMs will frequently attempt to format dates as YYYY-MM-DD. Furthermore, Lever has deprecated the /applications endpoints in favor of querying the /opportunities endpoint with an expand=applications parameter. If you build a custom connector based on outdated documentation, your agent will immediately fail on deprecated routes.
Unforgiving Rate Limits
Recruiting APIs endure massive burst traffic. When you execute an automated resume parsing workflow, you will hit Lever's rate limits instantly.
Here is a crucial architectural reality: Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Lever API returns an HTTP 429 (Too Many Requests), Truto passes that error directly to the caller.
However, Truto normalizes the chaotic upstream rate limit information into standardized IETF headers:
ratelimit-limit: The total requests allowed in the current window.ratelimit-remaining: The number of requests left.ratelimit-reset: The time at which the window resets.
Your agent framework is strictly responsible for interpreting the ratelimit-reset header, sleeping the execution thread, and retrying. If you do not build backoff into your agent loop, your autonomous workflow will crash.
Why a Unified Tool Layer Matters for Agent Safety
Direct API tools - writing one Python function per raw Lever endpoint - push vendor-specific quirks into the LLM's context window. The model has to remember that API-created postings skip approval chains, that stages require specific IDs rather than text names, and that resumes expire.
Every quirk is a hallucination risk.
A unified tool layer maps internal API definitions into standardized Resources and Methods. Truto handles the authentication, pagination, and query parameter processing, exposing a clean Proxy API.
When you call the Truto /integrated-account/:id/tools endpoint, it returns a precise JSON schema for every Method defined on a Resource. Your agent sees create_a_lever_posting with a strict validation schema requiring text, categories, and location. If the LLM invents a non-existent parameter, the tool schema rejects it deterministically before the network request ever fires.
Hero Tools for Lever AI Agents
Below are the highest-leverage tools available for orchestrating Lever via Truto. Do not expose your agent to generic CRUD endpoints it doesn't need; filter your tool requests to specific, actionable operations.
list_all_lever_opportunities
This is the core reconnaissance tool for your agent. It returns pipeline opportunities, current stages, origins, and timestamps. It is the mandatory first step before attempting to update a candidate's status or pull their resume.
"Find all active opportunities in the pipeline that were added in the last 48 hours and identify which stage they are currently sitting in."
lever_opportunities_move
Moving candidates across stages is the primary write action in ATS automation. This tool requires the specific opportunity_id and the destination stage ID. It returns a note ID confirming the stage change.
"The engineering team approved candidate ID 987654321. Move their opportunity to the 'Technical Interview' stage."
create_a_lever_posting
This tool enables autonomous job creation. It requires the job description text, team, department, and location. Note that API-created postings automatically skip the human approvals chain and cannot be marked confidential.
"Draft a new job posting for a Senior DevOps Engineer based in New York. Put it under the Engineering department and leave the state as a draft so a human can review it."
list_all_lever_resumes
Before an AI agent can evaluate a candidate, it needs their professional history. This tool retrieves not only the file metadata but Lever's parsedData object, which contains extracted positions and schools, saving you from writing custom OCR logic.
"Pull the parsed resume data for the candidate associated with opportunity ID 11223344. Summarize their last three roles and extract their education history."
list_all_lever_interviews
Agents need visibility into scheduling context to prevent double-booking or to trigger feedback loops. This tool lists interviews on an opportunity, including the panel, subject, interviewers, date, and duration.
"Check if any interviews are scheduled for opportunity ID 55667788 next week. If so, return the names of the interviewers on the panel."
lever_postings_application_questions
When an agent is building a custom careers portal or syncing data to an external form builder, it must know exactly what questions Lever requires for a specific job posting. This tool returns the form fields, descriptions, and whether they are required.
"Retrieve the custom application questions for the Senior Frontend Developer posting so we can generate a matching application form on the external landing page."
To view the complete inventory of available Lever tools, including schemas for notes, feedback forms, and requisition fields, visit the Lever integration page.
Building Multi-Step Workflows
Connecting a single tool is trivial. Orchestrating a multi-step workflow where an agent discovers a state, reacts to it, handles rate limit headers, and executes a chain of API calls requires a robust framework setup.
The following example uses TypeScript, LangChain, and the truto-langchainjs-toolset. It demonstrates fetching the tools dynamically via the API and running an autonomous agent loop.
import { ChatOpenAI } from "@langchain/openai";
import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents";
import { ChatPromptTemplate, MessagesPlaceholder } from "@langchain/core/prompts";
import { TrutoToolManager } from "truto-langchainjs-toolset";
async function runLeverAgent() {
// 1. Initialize Truto Tool Manager with your Lever Integrated Account ID
const toolManager = new TrutoToolManager({
apiKey: process.env.TRUTO_API_KEY,
accountId: process.env.LEVER_INTEGRATED_ACCOUNT_ID,
});
// 2. Fetch all Lever tools dynamically from the /tools endpoint
console.log("Fetching Lever tools from Truto...");
const tools = await toolManager.getTools();
// 3. Initialize the LLM
const llm = new ChatOpenAI({
modelName: "gpt-4o",
temperature: 0,
});
// 4. Define the Agent's system instructions
const prompt = ChatPromptTemplate.fromMessages([
[
"system",
"You are an autonomous recruiting operations agent. You manage job postings, parse candidate data, and transition pipeline stages in Lever. Always verify IDs before moving opportunities."
],
["human", "{input}"],
new MessagesPlaceholder("agent_scratchpad"),
]);
// 5. Create and execute the agent
const agent = await createOpenAIFunctionsAgent({
llm,
tools,
prompt,
});
const executor = new AgentExecutor({
agent,
tools,
maxIterations: 10,
});
try {
const result = await executor.invoke({
input: "Find all active opportunities. If any candidates are in the 'New Lead' stage, pull their resume data, evaluate if they have React experience, and if so, move their opportunity to the 'Screening' stage.",
});
console.log("Agent Execution Complete:", result.output);
} catch (error: any) {
// CRITICAL: Handle 429 Too Many Requests explicitly.
// Truto passes upstream rate limits directly to you.
if (error?.status === 429) {
const resetTime = error.headers['ratelimit-reset'];
console.error(`Rate limited by Lever. Resume operations after timestamp: ${resetTime}`);
// Implement your custom sleep/backoff logic here
} else {
console.error("Agent execution failed:", error);
}
}
}
runLeverAgent();The Architecture Behind the Execution
When the agent runs, it does not communicate with Lever directly. It communicates with the Truto Proxy API. This isolates the agent from authentication rot and complex query parameters.
sequenceDiagram
participant Agent as AI Agent
participant Truto as Truto Proxy API
participant Lever as Lever Upstream API
Agent->>Truto: Call list_all_lever_opportunities
Truto->>Lever: GET /v1/opportunities (with Bearer Token)
Lever-->>Truto: 200 OK (JSON payload)
Truto-->>Agent: Returns normalized JSON
Agent->>Truto: Call list_all_lever_resumes (id: 123)
Truto->>Lever: GET /v1/opportunities/123/resumes
Lever-->>Truto: 200 OK (Parsed Resume Data)
Truto-->>Agent: Returns normalized JSONWorkflows in Action
To understand the true utility of AI-driven ATS orchestration, we must look at concrete, multi-step workflows. These are not simple read operations; they are autonomous business processes.
Workflow 1: The Autonomous Resume Screener
Recruiting teams waste hundreds of hours manually opening PDFs to check for basic qualifications. An AI agent can process inbound applicants in real-time.
"Check the Lever pipeline for any opportunities currently sitting in the 'Applied' stage for the Data Scientist role. For each opportunity, pull their resume. If the parsed resume data indicates less than 3 years of experience with Python and SQL, move the opportunity to the 'Rejected' stage and add a note explaining the lack of technical requirements. If they meet the requirements, move them to 'Manager Review'."
Agent Execution Path:
- Calls
list_all_lever_opportunitiesfiltering for the specific posting ID and the 'Applied' stage. - Iterates through the results, calling
list_all_lever_resumesfor eachopportunity_id. - The LLM evaluates the
parsedDatareturned by Truto. - Based on the evaluation, it calls
lever_opportunities_moveto advance or reject the candidate. - Calls
create_a_lever_noteto append its reasoning directly to the candidate's profile.
Workflow 2: Programmatic Job Requisition Generation
When a hiring manager needs a new role opened, they typically fill out an internal Jira ticket or Google Form. An agent can bridge the gap between internal IT systems and Lever autonomously.
"We need a new posting for a Product Designer in London. Create the posting in Lever. Use standard design department categories. Leave the state as draft. Once created, fetch the default application questions for that posting so I can review them."
Agent Execution Path:
- The agent synthesizes a job description based on its internal prompt knowledge of a "Product Designer."
- Calls
create_a_lever_postingpassing the requiredtext,team,department, andlocationparameters, explicitly setting the state to 'draft'. - Extracts the newly generated posting ID from the response.
- Calls
lever_postings_application_questionsusing the new ID. - Returns a natural language summary to the user confirming the draft is ready for review and listing the default questions the applicant will face.
Workflow 3: Stalled Candidate Auditing
Candidates left lingering in intermediate stages damage employer brand and ruin time-to-hire metrics. An agent can autonomously audit the pipeline and escalate stale records.
"Audit the Lever pipeline. Find any opportunities in the 'Interview' stage where the last updated timestamp is older than 14 days. Find out who the hiring manager is, and add an internal secret note to those opportunities flagging them as stalled."
Agent Execution Path:
- Calls
list_all_lever_opportunitiesfiltering for the 'Interview' stage. - The agent calculates the time delta using the returned epoch timestamps.
- For any opportunity exceeding the threshold, it calls
get_single_lever_opportunity_by_idto fetch extended metadata. - Calls
create_a_lever_noteusing theopportunity_id, setting thesecretparameter to true, leaving a warning note for the talent team.
Moving Past Manual Integrations
Building an AI agent is fundamentally an exercise in state management and reasoning. Every sprint you spend parsing Lever's epoch timestamps, handling OAuth token refreshes, or trying to understand the difference between a contact and an opportunity is a sprint stolen from improving your core model.
By leveraging Truto's /tools endpoint, you offload the entire infrastructure burden of API integration. Your agent frameworks interact with a stable, documented, and deterministic unified layer. You retain complete control over the retry logic and execution flow, while Truto handles the chaotic reality of upstream SaaS communication.
Stop writing defensive API wrappers. Give your agents the schemas they need, and let them get to work.
FAQ
- How do AI agents handle Lever API rate limits?
- Truto does not retry or absorb rate limit errors. When the Lever API returns an HTTP 429, Truto passes that error back to your agent along with standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec. Your agent framework is responsible for implementing the retry and backoff logic.
- What is the difference between an opportunity and an application in Lever?
- Upstream, Lever has deprecated the applications endpoint in favor of the opportunities endpoint. An opportunity represents a candidate's progression through a specific job pipeline. You should use the list_all_lever_opportunities tool instead of attempting to fetch applications directly.
- Which AI agent frameworks can I use with Lever?
- Because Truto provides tool definitions as standardized JSON schemas via the /tools endpoint, you can use any framework that supports function calling, including LangChain, LangGraph, CrewAI, and the Vercel AI SDK.
- Can AI agents create job postings in Lever autonomously?
- Yes. Using the create_a_lever_posting tool, an AI agent can draft and publish job postings. Note that API-created postings skip the standard approval chains and default to a draft state unless specified otherwise.