Skip to content

Commit 26717e4

Browse files
go
1 parent 76705e8 commit 26717e4

3 files changed

Lines changed: 73 additions & 9 deletions

File tree

docs/english/_sidebar.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
"label": "AI & Agents",
1414
"link": {
1515
"type": "doc",
16-
"id": "tools/bolt-python/concepts/creating-an-agent"
16+
"id": "tools/bolt-python/concepts/adding-agent-features"
1717
},
1818
"items": [
19-
"tools/bolt-python/concepts/creating-an-agent",
20-
"tools/bolt-python/concepts/assistant-class"
19+
"tools/bolt-python/concepts/adding-agent-features",
20+
"tools/bolt-python/concepts/using-the-assistant-class"
2121
]
2222
},
2323
{

docs/english/concepts/creating-an-agent.md renamed to docs/english/concepts/adding-agent-features.md

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
2-
sidebar_label: Creating an agent
2+
sidebar_label: Adding agent features
33
---
44

5-
# Creating an agent with Bolt for Python
5+
# Adding agent features with Bolt for Python
66

77
:::tip[Check out the Support Agent sample app]
8-
The code snippets throughout this guide are from our [Support Agent sample app](https://github.com/slack-samples/bolt-python-support-agent), Casey, which supports integration with Pydantic, Anthropic, and OpenAI. View our [agent quickstart](/ai/agent-quickstart) to get up and running with Casey. Otherwise, read on for exploration and explanation of agent-focused Bolt features found within Casey.
8+
The code snippets throughout this guide are from our [Support Agent sample app](https://github.com/slack-samples/bolt-python-support-agent), Casey, which supports integration with Pydantic, Anthropic, and OpenAI.
9+
10+
View our [agent quickstart](/ai/agent-quickstart) to get up and running with Casey. Otherwise, read on for exploration and explanation of agent-focused Bolt features found within Casey.
911
:::
1012

1113
Your agent can utilize features applicable to messages throughout Slack, like [chat streaming](#text-streaming) and [feedback buttons](#adding-and-handling-feedback). They can also [utilize the `Assistant` class](/tools/bolt-python/concepts/assistant-class) for a side-panel view designed with AI in mind.
@@ -14,7 +16,7 @@ If you're unfamiliar with using these feature within Slack, you may want to read
1416

1517
## Prerequisites
1618

17-
You'll need a Slack app to mold into an agent via in this guide. Follow the [quickstart](/tools/bolt-python/getting-started), and then come back here!
19+
You'll need a Slack app to mold into an agent. Follow the [quickstart](/tools/bolt-python/getting-started), and then come back here!
1820

1921
---
2022

@@ -379,9 +381,71 @@ def handle_feedback_button(
379381

380382
---
381383

384+
## Defining agent tools
385+
386+
Your agent can perform actions by defining tools. A _tool_ in an agent context is a function that calls an external system.
387+
388+
The following example uses the Claude Agent SDK.
389+
390+
```python title="agent/tools/create_support_ticket.py"
391+
from claude_agent_sdk import tool
392+
393+
394+
@tool(
395+
name="create_support_ticket",
396+
description="Create a new IT support ticket for issues that require human follow-up.",
397+
input_schema={
398+
"type": "object",
399+
"properties": {
400+
"title": {
401+
"type": "string",
402+
"description": "A concise title describing the issue.",
403+
},
404+
"priority": {
405+
"type": "string",
406+
"description": "The ticket priority level.",
407+
"enum": ["low", "medium", "high", "critical"],
408+
},
409+
},
410+
"required": ["title", "priority"],
411+
},
412+
)
413+
async def create_support_ticket_tool(args):
414+
"""Create a new IT support ticket."""
415+
title = args["title"]
416+
priority = args["priority"]
417+
418+
ticket_id = f"INC-{random.randint(100000, 999999)}"
419+
420+
text = (
421+
f"Support ticket created successfully.\n"
422+
f"**Ticket ID:** {ticket_id}\n"
423+
f"**Priority:** {priority}"
424+
)
425+
426+
return {"content": [{"type": "text", "text": text}]}
427+
```
428+
429+
Then import and register the tool:
430+
431+
```python title="agent/casey.py"
432+
from claude_agent_sdk import create_sdk_mcp_server
433+
from agent.tools.create_support_ticket import create_support_ticket_tool
434+
435+
casey_tools_server = create_sdk_mcp_server(
436+
name="casey-tools",
437+
version="1.0.0",
438+
tools=[create_support_ticket_tool],
439+
)
440+
```
441+
442+
Your agent can then call those tools as needed.
443+
444+
---
445+
382446
## Full example
383447

384-
Putting all those concepts together result in a dynamic agent ready to helpfully respond.
448+
Putting all those concepts together results in a dynamic agent ready to helpfully respond.
385449

386450
<Tabs>
387451
<TabItem value="pydantic" label = "Pydantic">

docs/english/concepts/assistant-class.md renamed to docs/english/concepts/using-the-assistant-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The Assistant class
1+
# Using the Assistant class
22

33
:::info[Some features within this guide require a paid plan]
44
If you don't have a paid workspace for development, you can join the [Developer Program](https://api.slack.com/developer-program) and provision a sandbox with access to all Slack features for free.

0 commit comments

Comments
 (0)