Skip to content

Commit 31ea472

Browse files
stephentoubCopilot
andauthored
Fix Python session.send docs examples (#1312)
Update Python documentation examples to pass the prompt string positionally and use keyword arguments for mode, matching the current Python SDK API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 59f0981 commit 31ea472

2 files changed

Lines changed: 26 additions & 26 deletions

File tree

docs/auth/byok.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def main():
4949
done.set()
5050

5151
session.on(on_event)
52-
await session.send({"prompt": "What is 2+2?"})
52+
await session.send("What is 2+2?")
5353
await done.wait()
5454

5555
await session.disconnect()

docs/features/steering-and-queueing.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ async def main():
8282
)
8383

8484
# Start a long-running task
85-
msg_id = await session.send({
86-
"prompt": "Refactor the authentication module to use sessions",
87-
})
85+
msg_id = await session.send(
86+
"Refactor the authentication module to use sessions",
87+
)
8888

8989
# While the agent is working, steer it
90-
await session.send({
91-
"prompt": "Actually, use JWT tokens instead of sessions",
92-
"mode": "immediate",
93-
})
90+
await session.send(
91+
"Actually, use JWT tokens instead of sessions",
92+
mode="immediate",
93+
)
9494

9595
await client.stop()
9696
```
@@ -274,18 +274,18 @@ async def main():
274274
)
275275

276276
# Send an initial task
277-
await session.send({"prompt": "Set up the project structure"})
277+
await session.send("Set up the project structure")
278278

279279
# Queue follow-up tasks while the agent is busy
280-
await session.send({
281-
"prompt": "Add unit tests for the auth module",
282-
"mode": "enqueue",
283-
})
280+
await session.send(
281+
"Add unit tests for the auth module",
282+
mode="enqueue",
283+
)
284284

285-
await session.send({
286-
"prompt": "Update the README with setup instructions",
287-
"mode": "enqueue",
288-
})
285+
await session.send(
286+
"Update the README with setup instructions",
287+
mode="enqueue",
288+
)
289289

290290
# Messages are processed in FIFO order after each turn completes
291291
await client.stop()
@@ -507,19 +507,19 @@ session = await client.create_session(
507507
)
508508

509509
# Start a task
510-
await session.send({"prompt": "Refactor the database layer"})
510+
await session.send("Refactor the database layer")
511511

512512
# Steer the current work
513-
await session.send({
514-
"prompt": "Make sure to keep backwards compatibility with the v1 API",
515-
"mode": "immediate",
516-
})
513+
await session.send(
514+
"Make sure to keep backwards compatibility with the v1 API",
515+
mode="immediate",
516+
)
517517

518518
# Queue a follow-up for after this turn
519-
await session.send({
520-
"prompt": "Now add migration scripts for the schema changes",
521-
"mode": "enqueue",
522-
})
519+
await session.send(
520+
"Now add migration scripts for the schema changes",
521+
mode="enqueue",
522+
)
523523
```
524524

525525
</details>

0 commit comments

Comments
 (0)