> ## Documentation Index
> Fetch the complete documentation index at: https://developers.nexspace365.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Composio

> Use NexSpace tools from LangChain, CrewAI, and other agent frameworks

# Composio Integration

The NexSpace toolkit on [Composio](https://composio.dev) makes all 16 tools
available to LangChain, CrewAI, Vercel AI SDK, OpenAI Agents SDK, and any
framework that uses Composio's SDK.

## Install

```python theme={null}
from composio import ComposioToolSet

toolset = ComposioToolSet()
tools = toolset.get_tools(apps=["nexspace"])
```

## Connect

Composio handles the OAuth 2.1 + PKCE flow automatically:

```python theme={null}
entity = toolset.get_entity("default")
connection = entity.initiate_connection(app_name="nexspace")
print(connection.redirect_url)  # User opens this in browser
```

## Available Tools

All 16 NexSpace verbs are available as Composio tools:

```
NEXSPACE_FIND_CREDENTIALED_STAFF
NEXSPACE_FILL_SHIFT
NEXSPACE_PROPOSE_SHIFT_SCHEDULE
NEXSPACE_SWAP_SHIFTS
NEXSPACE_GET_FACILITY_COVERAGE
NEXSPACE_VERIFY_CREDENTIAL
NEXSPACE_LIST_EXPIRING_CREDENTIALS
NEXSPACE_SEARCH_STAFF
NEXSPACE_GET_STAFF_MEMBER
NEXSPACE_PREVIEW_PAYROLL_RUN
NEXSPACE_RUN_PAYROLL
NEXSPACE_NOTIFY_SHIFT_SWAP
NEXSPACE_QUALIFY_LEAD
NEXSPACE_SEARCH_LEADS
NEXSPACE_LIST_FACILITIES
NEXSPACE_GET_FACILITY
```

## Example: LangChain Agent

```python theme={null}
from langchain.agents import create_openai_tools_agent
from composio_langchain import ComposioToolSet

toolset = ComposioToolSet()
tools = toolset.get_tools(apps=["nexspace"])

agent = create_openai_tools_agent(llm, tools, prompt)
agent.invoke({"input": "Find available staff for facility 12's morning shift"})
```

## API Key Fallback

For environments where browser-based OAuth is impossible, use API key auth:

```python theme={null}
toolset = ComposioToolSet(api_key="nex_live_YOUR_KEY")
```
