|
1 | | -# Welcome to MkDocs |
| 1 | +# Redpanda Agents |
2 | 2 |
|
3 | | -For full documentation visit [mkdocs.org](https://www.mkdocs.org). |
| 3 | +The [Redpanda Agent SDK](https://github.com/redpanda-data/agent) allows you to build agentic [Redpanda Connect](https://www.redpanda.com/connect) pipelines. |
4 | 4 |
|
5 | | -## Commands |
| 5 | +You can use [`rpk`](https://docs.redpanda.com/current/get-started/intro-to-rpk/) to generate the initial boilerplate for an agentic pipeline. |
6 | 6 |
|
7 | | -* `mkdocs new [dir-name]` - Create a new project. |
8 | | -* `mkdocs serve` - Start the live-reloading docs server. |
9 | | -* `mkdocs build` - Build the documentation site. |
10 | | -* `mkdocs -h` - Print help message and exit. |
| 7 | +```bash |
| 8 | +$ rpk connect agent init my_first_agent |
11 | 9 |
|
12 | | -## Project layout |
| 10 | +$ ls --tree ./my_first_agent |
| 11 | +my_first_agent |
| 12 | +├── agents |
| 13 | +│ └── weather.py |
| 14 | +├── mcp |
| 15 | +│ └── resources |
| 16 | +│ └── processors |
| 17 | +│ └── check_weather_tool.yaml |
| 18 | +├── pyproject.toml |
| 19 | +├── README.md |
| 20 | +├── redpanda_agents.yaml |
| 21 | +└── uv.lock |
| 22 | +``` |
13 | 23 |
|
14 | | - mkdocs.yml # The configuration file. |
15 | | - docs/ |
16 | | - index.md # The documentation homepage. |
17 | | - ... # Other markdown pages, images and other files. |
| 24 | +## Project Structure |
18 | 25 |
|
| 26 | +The project structure is as follows: |
19 | 27 |
|
20 | | -**This project** provides a flexible system where an *Agent* can answer questions and use specialized *Tools* to tackle tasks. |
21 | | -The Agent can also connect to external services through different **MCPEndpoints**, letting it integrate with remote or local resources. |
| 28 | +### `redpanda_agents.yaml` |
22 | 29 |
|
23 | | -A **RuntimeServer** exposes the Agent over gRPC, so outside applications can interact with it. |
24 | | -The project includes *hooks* to track key events (like before or after a tool is called) and a *ToolResponse* structure for sending back text or images neatly. |
| 30 | +The main entry point for the agent pipeline. The file looks like the following: |
25 | 31 |
|
26 | | -The **RPKMCPEndpoint** even simplifies testing by running a local command to simulate a server inside your development folder. |
| 32 | +```yaml |
| 33 | +# Each agent is an entry under `agents` - there can be multiple for multi-agent flows. |
| 34 | +agents: |
| 35 | + # The name of the agent determines what python file is executed for the agent. |
| 36 | + <agent_name>: |
| 37 | + # Any Redpanda Connect input is valid here |
| 38 | + # See them all at: https://docs.redpanda.com/redpanda-connect/components/inputs/about/ |
| 39 | + input: |
| 40 | + <input> |
| 41 | + # Any tool labels defined in the `mcp` directory, see notes below for more. |
| 42 | + tools: |
| 43 | + - <tool label> |
| 44 | + # Any Redpanda Connect output is valid here |
| 45 | + # See them all at https://docs.redpanda.com/redpanda-connect/components/outputs/about/ |
| 46 | + output: |
| 47 | + <output> |
| 48 | + # See options here: https://docs.redpanda.com/redpanda-connect/components/tracer/about/ |
| 49 | + tracer: |
| 50 | + <tracer> |
| 51 | +``` |
27 | 52 |
|
| 53 | +### `agents/*.py` |
28 | 54 |
|
| 55 | +Each agent recieves input from `input` and sends it's output to `output`. You can create an agent |
| 56 | +by importing from `redpanda.agents`. Creating an `Agent` looks like: |
29 | 57 |
|
30 | | -## Chapters |
| 58 | +```python |
| 59 | +my_agent = Agent( |
| 60 | + name="my_first_agent", |
| 61 | + model="openai/gpt-4o", |
| 62 | + instructions="These are your instructions - good luck!", |
| 63 | +) |
| 64 | +``` |
31 | 65 |
|
32 | | -1. [Agent |
33 | | -](01_agent_.md) |
34 | | -2. [Tool |
35 | | -](02_tool_.md) |
36 | | -3. [ToolResponse |
37 | | -](03_toolresponse_.md) |
38 | | -4. [AgentHooks |
39 | | -](04_agenthooks_.md) |
40 | | -5. [MCPEndpoint |
41 | | -](05_mcpendpoint_.md) |
42 | | -6. [RPKMCPEndpoint |
43 | | -](06_rpkmcpendpoint_.md) |
44 | | -7. [mcp_client |
45 | | -](07_mcp_client_.md) |
46 | | -8. [RuntimeServer |
47 | | -](08_runtimeserver_.md) |
| 66 | +Once you've created the agent, you pass it off to the runtime to handle messages in the pipeline like so: |
48 | 67 |
|
| 68 | +```python |
| 69 | +asyncio.run(redpanda.runtime.serve(my_agent)) |
| 70 | +``` |
49 | 71 |
|
50 | | ---- |
| 72 | +### `mcp/resources/processors/*.yaml` |
| 73 | + |
| 74 | +In order to give tools to your agent, you need to first define them as yaml files with the following structure: |
| 75 | + |
| 76 | +```yaml |
| 77 | +label: '<label>' |
| 78 | +processors: |
| 79 | + - <processors> |
| 80 | +meta: |
| 81 | + mcp: |
| 82 | + enabled: true |
| 83 | + description: '<description>' |
| 84 | +``` |
| 85 | + |
| 86 | +The `<label>` is what must be provided under the list of `tools` in the agent YAML file, while the |
| 87 | +processors can be any [Redpanda Connect processor](https://docs.redpanda.com/redpanda-connect/components/processors/about/). |
| 88 | + |
| 89 | +<!-- |
| 90 | +TODO |
| 91 | + |
| 92 | +### `mcp/resources/caches/*.yaml` |
| 93 | + |
| 94 | +### `mcp/o11y/tracer.yaml` |
| 95 | + |
| 96 | +### `mcp/o11y/metrics.yaml` |
| 97 | + |
| 98 | +--> |
| 99 | + |
| 100 | +## Running |
| 101 | + |
| 102 | +To run our agent, we can do that with `rpk connect agent run my_first_agent` |
51 | 103 |
|
52 | | -Generated by [AI Codebase Knowledge Builder](https://github.com/The-Pocket/Tutorial-Codebase-Knowledge) |
|
0 commit comments