Skip to content

Connect ShiftCare to AI Agents: Sync Workforce Data and Client Funds

Learn how to natively connect ShiftCare to AI agents using Truto's /tools endpoint. Build autonomous workflows for NDIS fund tracking, shift scheduling, and compliance.

Riya Sethi Riya Sethi · · 10 min read
Connect ShiftCare to AI Agents: Sync Workforce Data and Client Funds

You want to connect ShiftCare to an AI agent so your system can independently read staff schedules, update NDIS client funds, file compliance notes, and generate payroll records based on real-time healthcare context. Here is exactly how to do it using Truto's /tools endpoint and SDK, bypassing the need to manually build, secure, and maintain dozens of complex API endpoints.

Giving a Large Language Model (LLM) read and write access to your ShiftCare instance is an engineering minefield. You either spend weeks reading API documentation, dealing with complex entity relationships (Clients vs. Staff vs. Shifts vs. Funds), or you use a managed infrastructure layer that handles the boilerplate and exposes AI-native tool schemas. If your team uses ChatGPT, check out our guide on connecting ShiftCare to ChatGPT, or if you are building on Anthropic's models, read our guide on connecting ShiftCare 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 ShiftCare, bind them natively to an LLM using LangChain (or any framework like LangGraph, CrewAI, or Vercel AI SDK), and execute complex care management workflows. For a deeper look at the architecture behind this approach, refer to our research on architecting AI agents and the SaaS integration bottleneck.

The Engineering Reality of Custom ShiftCare Connectors

Building an AI agent is a solved problem. Connecting that agent to a niche healthcare and workforce management platform like ShiftCare is an ongoing operational burden. Giving an LLM access to external data seems straightforward in a local prototype. You write a fetch request, wrap it in a tool decorator, and move on. In production, this approach collapses.

If you decide to build a custom ShiftCare connector, you own the entire API lifecycle. ShiftCare's API introduces several domain-specific integration challenges that break standard LLM assumptions and generic tool abstractions.

NDIS Compliance and Invoiced Shift Locks

ShiftCare is built heavily around the Australian National Disability Insurance Scheme (NDIS) and generalized care billing. When an agent attempts to delete or significantly modify a shift, the API does not just execute a simple database DELETE. If a shift has already been invoiced, the ShiftCare API explicitly rejects the deletion with an HTTP 409 Conflict. If your LLM is unaware of this business logic, it will repeatedly attempt to delete the shift, enter an infinite retry loop, and waste tokens. An agent must be programmed to read the invoice status before attempting destructive actions, or natively understand 409 responses to pivot its strategy.

Date Parsing and Timezone Fallbacks

When creating client notes or logging incidents, timestamps are critical for medical and legal compliance. ShiftCare's API expects precise formatting. If an agent omits a requested date on a client note payload, the API defaults to the current UTC date. In care environments across different local timezones, defaulting to UTC can push an incident report into the wrong calendar day, creating a severe compliance violation. Your agent must either strictly enforce local timezone formatting before payload submission or use validated schemas that prevent omitted date fields.

Rate Limits and Normalized Headers

The ShiftCare API restricts how many requests you can make in a given window. A common architectural mistake is assuming the integration layer will magically absorb these limits. Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream ShiftCare API returns an HTTP 429, Truto passes that error directly to the caller.

However, Truto normalizes upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. This means your agent framework does not need to parse ShiftCare-specific error bodies. It simply reads the standard headers and dictates the backoff strategy. The caller is strictly responsible for retry execution.

ShiftCare Hero Tools for AI Agents

To build highly capable care agents, you do not need to expose all 150+ endpoints to the LLM. Doing so bloats the context window and increases the risk of hallucination. Instead, you expose high-leverage "hero tools" that represent the core operations of care coordination.

Here are seven highly effective ShiftCare tools you can fetch from Truto and pass to your agent.

1. List Shifts

Retrieves the core schedule. This tool allows the agent to pull shifts filtered by client IDs, staff IDs, date ranges, and billable flags. It is the primary data source for any scheduling or roster-based reasoning.

Usage note: Because shifts contain deeply nested data (clients, staff, tasks, recurrences), limit the date range in the prompt to prevent overflowing the LLM context window.

"Fetch all shifts for client ID 98234 between Monday and Wednesday of next week. Identify any shifts that currently have no staff assigned."

2. Update a Shift by ID

Modifies an existing shift. Once an agent identifies an unassigned shift or a scheduling conflict, it uses this tool to attach a new staff ID or modify the start and end times.

Usage note: The agent must pass the full required schema. Partial updates require the agent to first fetch the shift, modify the specific JSON keys in memory, and push the updated object back.

"Assign staff member ID 4452 to the open shift on Tuesday morning (shift ID 8831). Keep the existing client and task lists intact."

3. List Client Funds

Fetches the NDIS or private funding balances for a specific client. The Fund entity stores cashflow data and is required before an agent can safely plan new services or approve additional care hours.

Usage note: Always mandate the agent to call this tool before creating new shifts to ensure the client has sufficient balance (monetary or hours) before expiry.

"Check the current fund balances for Client ID 98234. If they have more than 10 hours remaining in their current funding block, we can proceed with booking the weekend shift."

4. Create a Client Note

Logs a new compliance, clinical, or general note against a client's profile. This is heavily used by agents that summarize post-shift voice transcripts or transcribe field worker emails.

Usage note: Ensure the agent explicitly sets the requested_date using the local account timezone to prevent ShiftCare from defaulting to a misaligned UTC date.

"Create a client note for John Doe (ID 98234) summarizing the physical therapy session from today. Mark the category as 'Clinical' and ensure the private flag is set to false."

5. List Staff

Retrieves the workforce directory. The agent uses this to find available caregivers, check their listed roles, employment types, and contact information.

Usage note: Returns heavy payloads. Use this to construct a roster context before reasoning about who to assign to a complex care requirement.

"Pull a list of all active staff members. Find a caregiver who lists 'Auslan' in their languages and has the role of 'Registered Nurse'."

6. Create Leave External ID

Links a specific ShiftCare leave record to an external payroll or HR system identifier. This is critical for agents automating payroll reconciliation.

Usage note: Requires the leave_id and the external type (e.g., "Xero", "KeyPay"). This enables cross-platform agents to bridge ShiftCare with accounting software.

"Link approved leave ID 5512 in ShiftCare to the external payroll ID 'LVE-992' in the accounting system."

7. List Complaints

Retrieves compliance incidents and complaints. Agents acting in a compliance auditing capacity use this to track risk levels and closure dates across the organization.

Usage note: The agent can filter by status, risk level, or date range. This prevents the LLM from hallucinating compliance metrics during reporting.

"List all complaints received in the last 30 days that have a risk level of 'high' and are still in the 'received' status. Summarize the safety concerns."

For a complete list of all available ShiftCare operations, schemas, and endpoints, visit the ShiftCare integration page.

Workflows in Action

Individual tools are useful, but the real power of an AI agent lies in chaining these tools together to solve complex, multi-step business problems. Here is how different personas interact with an agent powered by Truto's ShiftCare tool schemas.

Scenario 1: The Care Coordinator (Fund Checking & Rostering)

The care coordinator needs to quickly reassign a dropped shift, but only if the client has enough NDIS funding left to cover the specific staff member's rates.

"Client 1045 requested an extra emergency shift this weekend. Check their fund balance. If they have enough hours, find an available Registered Nurse and book the shift for Saturday 9 AM to 1 PM."

  1. shift_care_clients_list_funds: The agent fetches the client's fund balances and confirms they have 15 hours remaining before expiry.
  2. list_all_shift_care_staff: The agent queries the staff directory to find active staff members with the 'Registered Nurse' role.
  3. list_all_shift_care_shifts: The agent checks the existing shifts for the selected nurse to ensure they are not double-booked on Saturday morning.
  4. create_a_shift_care_shift: The agent constructs the payload and creates the new shift, linking the client and the available nurse.

The coordinator gets back a confirmation message: "The client has 15 hours remaining. I have scheduled Sarah Jenkins (RN) for the Saturday 9 AM shift. Shift ID is 8892."

Scenario 2: The Compliance Officer (Incident Triage)

A compliance officer wants a daily summary of high-risk operational issues and needs them attached to the respective client files.

"Find any 'high' risk complaints logged yesterday. Summarize the safety concern and attach that summary as a private client note to the affected clients."

  1. list_all_shift_care_complaints: The agent fetches complaints filtered by the previous day's date range and the 'high' risk level.
  2. Internal LLM Reasoning: The model reads the raw description and safety_concern fields from the JSON payload and generates a professional, concise clinical summary.
  3. create_a_shift_care_client_note: For each complaint, the agent loops through the affected client_ids, submitting the generated summary as a new note with the private flag set to true.

The compliance officer receives: "Found 2 high-risk complaints from yesterday. I have summarized the incident reports and attached them as private notes to Client ID 441 and Client ID 892."

Scenario 3: The HR Admin (Leave & Payroll Bridging)

An HR administrator needs to ensure that all approved medical leave in ShiftCare is properly linked to the external payroll software for the upcoming pay run.

"Check all leave requests approved this week. For each approved leave, generate an external ID mapping it to the payroll system."

  1. list_all_shift_care_leaves: The agent queries the leave endpoint, filtering for items where the approved_at timestamp falls within the current week.
  2. shift_care_leaves_create_external_id: The agent iterates over the approved leave IDs and pushes a payload containing type: 'payroll_system' and a generated external_id to link the systems.

The HR admin gets: "Processed 4 approved leave records. External payroll IDs have been successfully mapped to the ShiftCare leave entities."

Building Multi-Step Workflows

To execute the workflows described above, your architecture must securely pass Truto tools to the agent framework, handle execution loops, and gracefully manage API constraints like rate limits.

Because Truto exposes tools via standard JSON schemas from the /tools endpoint, you are not locked into a specific framework. Whether you use LangChain, LangGraph, or Vercel AI SDK, the pattern remains identical.

Below is an architectural representation of how a multi-step agent loop operates using Truto as the unified proxy layer.

sequenceDiagram
    participant User as User Prompt
    participant Agent as Agent Framework (LangChain)
    participant Truto as Truto Tool Layer
    participant ShiftCare as ShiftCare API

    User->>Agent: "Check client funds and book shift"
    Agent->>Truto: Fetch Tool Schemas (GET /tools)
    Truto-->>Agent: Returns JSON Schemas
    
    Note over Agent: LLM decides to check funds
    Agent->>Truto: Execute shift_care_clients_list_funds(client_id: 1045)
    Truto->>ShiftCare: GET /clients/1045/funds
    ShiftCare-->>Truto: 200 OK (Fund details)
    Truto-->>Agent: JSON Response

    Note over Agent: LLM parses funds, decides to book
    Agent->>Truto: Execute create_a_shift_care_shift(...)
    Truto->>ShiftCare: POST /shifts
    ShiftCare-->>Truto: 201 Created
    Truto-->>Agent: JSON Response
    
    Agent-->>User: "Shift booked successfully."

Handling Rate Limits Gracefully

When writing your tool execution code, you must handle the scenario where the ShiftCare API is overloaded. Remember: Truto passes 429 Too Many Requests directly to your agent. You must inspect the ratelimit-reset header to pause your agent loop.

Here is an example using TypeScript and the truto-langchainjs-toolset. The code fetches the tools, binds them to an OpenAI model, and includes a wrapper that respects Truto's standardized rate limit headers.

import { ChatOpenAI } from "@langchain/openai";
import { TrutoToolManager } from "truto-langchainjs-toolset";
 
async function runShiftCareAgent(userPrompt: string) {
  // 1. Initialize the LLM
  const llm = new ChatOpenAI({ 
      modelName: "gpt-4o",
      temperature: 0 
  });
 
  // 2. Initialize Truto Tool Manager with your Integrated Account ID
  const toolManager = new TrutoToolManager({
    apiKey: process.env.TRUTO_API_KEY,
    accountId: process.env.SHIFTCARE_ACCOUNT_ID,
  });
 
  // 3. Fetch ShiftCare tools from Truto
  // We filter for core scheduling and client operations
  const tools = await toolManager.getTools({
    methods: ["read", "write", "custom"]
  });
 
  // 4. Bind the tools to the LLM
  const llmWithTools = llm.bindTools(tools);
 
  console.log(`Bound ${tools.length} ShiftCare tools to the agent.`);
 
  // 5. Execute the agent loop with Rate Limit handling
  try {
    // In a real framework like LangGraph, this is handled by a ToolNode
    // This is a simplified representation of tool invocation
    const response = await llmWithTools.invoke([
      { role: "user", content: userPrompt }
    ]);
 
    console.log("Agent decision:", response);
 
  } catch (error: any) {
    // Explicitly handle standard Truto rate limit passing
    if (error.status === 429) {
      const resetTime = error.headers['ratelimit-reset'];
      const waitSeconds = Math.ceil(resetTime - (Date.now() / 1000));
      
      console.warn(`Rate limit hit. Must backoff for ${waitSeconds} seconds.`);
      // Implement your sleep/retry logic here
      // await sleep(waitSeconds * 1000);
      // return runShiftCareAgent(userPrompt);
    } else {
      console.error("ShiftCare API Error:", error.message);
    }
  }
}
 
// Run the coordinator workflow
runShiftCareAgent("Check funds for Client 1045 and find an available nurse.");

By leveraging the truto-langchainjs-toolset, the framework automatically converts Truto's /tools endpoint response into strict Zod schemas that the LangChain bindTools() function natively understands. The agent gets a perfect definition of ShiftCare's inputs, minimizing hallucination on complex fields like fund_id or ISO 8601 timestamps.

Moving Beyond Point-to-Point Integration

Connecting an AI agent to a complex workforce management tool like ShiftCare requires more than just knowing how to make an HTTP request. It requires handling intricate domain constraints - like NDIS fund logic, rigid timezone rules, and un-deletable invoiced shifts - while ensuring the agent does not crash on a standard 429 rate limit.

By routing your agent traffic through Truto's unified proxy layer, you offload the authentication, schema normalization, and tool definition formatting. Your engineering team can focus on tuning the agent's prompt instructions and reasoning loops, rather than reading vendor API docs and debugging missing JSON keys. You get stable, AI-ready tools that make your care management workflows genuinely autonomous.

FAQ

How do AI agents authenticate with the ShiftCare API?
AI agents authenticate via Truto's unified proxy layer. You connect the ShiftCare account once in the Truto dashboard, and Truto handles the underlying API keys and OAuth tokens, exposing a unified set of tools that the agent calls using a single Truto bearer token.
Does Truto automatically retry failed ShiftCare API requests?
No. Truto passes upstream rate limits (HTTP 429) directly to the caller. However, Truto normalizes the rate limit information into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset), leaving the retry and backoff logic to your agent or framework.
Can I restrict which ShiftCare tools my AI agent can access?
Yes. When fetching tools from Truto's /tools endpoint, you can filter by HTTP method (e.g., read-only) or manually omit specific high-risk tools (like delete operations) before binding them to your LLM.
Which agent frameworks support Truto's ShiftCare tools?
Truto's tools are framework-agnostic. They are exposed as standard JSON schemas, meaning they can be bound to LangChain, LangGraph, CrewAI, Vercel AI SDK, or custom reasoning loops.

More from our Blog