Skip to content

Commit 4858ccc

Browse files
committed
Make the agent more fun
1 parent 3965c25 commit 4858ccc

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

examples/anthropic_tool_use.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
user_message: MessageParam = {
2121
"role": "user",
22-
"content": "What is the test coverage for this repository: https://github.com/gitpod-io/gitpod-sdk-go",
22+
"content": "Find the test coverage for this repository: https://github.com/gitpod-io/gitpod-sdk-go. Once done, make sure all tests pass by removing the test files.",
2323
}
2424
tools: list[ToolParam] = [
2525
{
@@ -59,7 +59,7 @@ async def create_environment(args: dict[str, str], cleanup: util.Disposables) ->
5959
"machine": {"class": env_class.id},
6060
}
6161
)).environment
62-
cleanup.adda(lambda: gpclient.environments.delete(environment_id=environment.id))
62+
# cleanup.adda(lambda: gpclient.environments.delete(environment_id=environment.id))
6363

6464
print(f"\nCreated environment: {environment.id} - waiting for it to be ready...")
6565
await util.wait_for_environment_running(gpclient, environment.id)
@@ -82,7 +82,12 @@ async def main(cleanup: util.Disposables) -> None:
8282
messages=messages,
8383
tools=tools,
8484
)
85-
print(f"\nResponse: {message.model_dump_json(indent=2)}")
85+
# pretty print the message and tool use
86+
for c in message.content:
87+
if c.type == "tool_use":
88+
print(f"\nTool use: {c.model_dump_json(indent=2)}")
89+
elif c.type == "text":
90+
print(f"\nText: {c.text}")
8691

8792
if message.stop_reason != "tool_use":
8893
print(f"\nFinal response reached! {message.model_dump_json(indent=2)}")

examples/run_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def main(cleanup: util.Disposables) -> None:
4444

4545
print("Creating environment")
4646
environment = (await client.environments.create(spec=spec)).environment
47-
cleanup.adda(lambda: client.environments.delete(environment_id=environment.id))
47+
# cleanup.adda(lambda: client.environments.delete(environment_id=environment.id))
4848

4949
print("Waiting for environment to be ready")
5050
await util.wait_for_environment_running(client, environment.id)

0 commit comments

Comments
 (0)