Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
in chat fixes
Sushmithamallesh committed
Dec 10, 2025 at 20:11 UTC
decfe900a75e7e6f1193a664b87dab4600dce63e
3 files changed
+19
-15
fern/pages/src/tool-router/using-in-chat-authentication.mdx
+17
-13
@@ -19,35 +19,30 @@ By just creating a session with default configs, you are enabling in-chat auth.
19
20
<CodeGroup>
21
```python
22
-session = await composio.create(
23
- user="user_123",
24
- manage_connections=True, # default
25
-)
22
+session = composio.create(user_id="user_123")
23
```
24
```typescript
28
-const session = await composio.create("user_123", {
29
- manageConnections: true, // default
30
-});
25
+const session = await composio.create("user_123");
26
```
27
</CodeGroup>
28
29
### Custom callback URL
30
36
-Redirect users to a specific page after authentication:
31
+Redirect users back to your chat page after they complete authentication:
32
33
<CodeGroup>
34
```python
40
-session = await composio.create(
41
- user="user_123",
35
+session = composio.create(
36
+ user_id="user_123",
37
manage_connections={
38
"callback_url": "https://yourapp.com/chat"
39
},
40
)
41
```
42
```typescript
48
-const { mcp } = await composio.create("user_123", {
43
+const session = await composio.create("user_123", {
44
manageConnections: {
50
- callbackUrl: "https://yourapp.com/chat",
45
+ callbackUri: "https://yourapp.com/chat",
46
},
47
});
48
```
@@ -65,4 +60,13 @@ What this looks like when you run the code:
60
```
61
Assistant: What would you like me to do today?
62
68
-> Star the composio repo on GitHub
\ No newline at end of file
63
+> Star the composio repo on GitHub
64
+Assistant: I need you to connect your GitHub account first.
65
+Please click here to authorize: https://connect.composio.dev/link/ln_abc123
66
+
67
+> Done
68
+
69
+Assistant: Done! I've starred ComposioHQ/composio.
70
+```
71
+
72
+To manage authentication outside of chat, see [Manually authenticating users](/tool-router/manually-authenticating-users).
fern/snippets/tool-router/python/in-chat-auth.py
+1
-1
@@ -5,7 +5,7 @@ from agents import Agent, Runner, HostedMCPTool, ModelSettings
5
composio_api_key = os.environ.get("COMPOSIO_API_KEY")
6
user_id = "user_123" # Your user's unique identifier
7
8
-composio = Composio()
8
+composio = Composio(api_key=composio_api_key)
9
session = composio.create(user_id=user_id)
10
11
agent = Agent(
fern/snippets/tool-router/python/quickstart-openai.py
+1
-1
@@ -5,7 +5,7 @@ from agents import Agent, Runner, HostedMCPTool, ModelSettings
5
composio_api_key = os.environ.get("COMPOSIO_API_KEY")
6
user_id = "user_123" # Your user's unique identifier
7
8
-composio = Composio()
8
+composio = Composio(api_key=composio_api_key)
9
session = composio.create(user_id=user_id)
10
11
agent = Agent(