Skip to content

Commit 6a91675

Browse files
committed
docs: fix typos and async code samples
1 parent 20af97f commit 6a91675

File tree

6 files changed

+30
-11
lines changed

6 files changed

+30
-11
lines changed

docs/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ agents:
4545
# See them all at https://docs.redpanda.com/redpanda-connect/components/outputs/about/
4646
output:
4747
<output>
48-
# See options here: https://docs.redpanda.com/redpanda-connect/components/tracer/about/
48+
# Configure Redpanda Connect to send tracing events to Jaeger, Open Telemetry collector and more.
49+
# See options here: https://docs.redpanda.com/redpanda-connect/components/tracers/about/
4950
tracer:
5051
<tracer>
5152
```
5253
5354
### `agents/*.py`
5455

55-
Each agent recieves input from `input` and sends it's output to `output`. You can create an agent
56+
Each agent receives input from `input` and sends its output to `output`. You can create an agent
5657
by importing from `redpanda.agents`. Creating an `Agent` looks like:
5758

5859
```python
@@ -63,6 +64,8 @@ my_agent = Agent(
6364
)
6465
```
6566

67+
In this example, OpenAI GPT-4o is configured and requires you to set `OPENAI_API_KEY` as an environment variable.
68+
6669
Once you've created the agent, you pass it off to the runtime to handle messages in the pipeline like so:
6770

6871
```python

docs/tutorial/01_agent_.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Below is a short snippet showing how we can instantiate and use an Agent:
2424

2525
```python
2626
# In a file like main.py
27+
import asyncio
2728
from redpanda.agents import Agent
2829

2930
# Create an agent with minimal setup
@@ -34,8 +35,11 @@ my_agent = Agent(
3435
)
3536

3637
# Now let's ask something
37-
response = await my_agent.run("Hello Agent, what's your favorite color?")
38-
print(response) # It will print a response based on the language model
38+
async def run_agent():
39+
response = asyncio.run(my_agent.run("Hello Agent, what's your favorite color?"))
40+
print(response) # It will print a response based on the language model
41+
42+
asyncio.run(run_agent())
3943
```
4044

4145
Explanation of the snippet:

docs/tutorial/02_tool_.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Imagine we have an Agent that wants to handle math questions. Let’s register o
8585

8686
```python
8787
# main.py
88+
import asyncio
8889
from redpanda.agents import Agent
8990
from number_cruncher_tool import NumberCruncher
9091

@@ -100,8 +101,11 @@ my_agent = Agent(
100101
)
101102

102103
# Agent usage
103-
response = await my_agent.run("What is the product of 3 and 4?")
104-
print(response)
104+
async def run_agent():
105+
response = await my_agent.run("What is the product of 3 and 4?")
106+
print(response)
107+
108+
asyncio.run(run_agent())
105109
```
106110

107111
### Explanation of What Happens

docs/tutorial/03_toolresponse_.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Let’s create an Agent using our `PictureMaker` tool. Suppose we send the Agent
8787

8888
```python
8989
# main.py
90+
import asyncio
9091
from redpanda.agents import Agent
9192
from picture_maker_tool import PictureMaker
9293

@@ -102,8 +103,11 @@ my_agent = Agent(
102103
)
103104

104105
# 3) Run and see what happens
105-
response = await my_agent.run("Please generate me a picture of a small cat.")
106-
print(response) # The Agent will eventually include text + image data in some manner
106+
async def run_agent():
107+
response = await my_agent.run("Please generate me a picture of a small cat.")
108+
print(response) # The Agent will eventually include text + image data in some manner
109+
110+
asyncio.run(run_agent())
107111
```
108112

109113
### What Happens Behind the Scenes?

docs/tutorial/04_agenthooks_.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Let’s attach our `MyLoggingHooks` to an Agent. Now, whenever the Agent decides
5050

5151
```python
5252
# main.py
53+
import asyncio
5354
from redpanda.agents import Agent
5455
from custom_hooks import MyLoggingHooks
5556
from number_cruncher_tool import NumberCruncher # from previous chapters
@@ -62,8 +63,11 @@ my_agent = Agent(
6263
)
6364

6465
# Run a sample query to see the hooks in action
65-
response = await my_agent.run("What is 3 + 4?")
66-
print("Final response:", response)
66+
async def run_agent():
67+
response = await my_agent.run("What is 3 + 4?")
68+
print("Final response:", response)
69+
70+
asyncio.run(run_agent())
6771
```
6872

6973
What happens:

docs/tutorial/05_mcpendpoint_.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In the [previous chapter: AgentHooks](04_agenthooks_.md), we saw how to track ke
66

77
## 1. Why MCPEndpoint?
88

9-
Sometimes, your Agent might not have all the tools it needs locally. Or maybe you want to delegate tasks to a remote service. MCPEndpoint is like creating a “phone line” for your Agent to talk to any external MCP (Multi-Channel Processing?) server, whether it’s running on your local machine or out on the internet.
9+
Sometimes, your Agent might not have all the tools it needs locally. Or maybe you want to delegate tasks to a remote service. MCPEndpoint is like creating a “phone line” for your Agent to talk to any external MCP (Model Context Protocol) server, whether it’s running on your local machine or out on the internet.
1010

1111
For example:
1212
• You can connect via standard input/output (like launching a program and talking with it).

0 commit comments

Comments
 (0)