Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions examples/07_response_traces/01_operator_trace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import asyncio
import json

from narada import Agent, AgentKind, BrowserEnvironment


async def main() -> None:
env = BrowserEnvironment()
agent = Agent(environment=env, kind=AgentKind.OPERATOR)

try:
response = await agent.run(
prompt=(
"Open https://example.com and tell me the page heading and current URL."
)
)

print("Response:", response.text)
print("Trace:")
print(
json.dumps(
[record.model_dump(mode="json") for record in response.trace],
indent=2,
)
)
finally:
await env.close()


if __name__ == "__main__":
asyncio.run(main())
27 changes: 27 additions & 0 deletions examples/07_response_traces/02_agent_studio_trace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import asyncio
import json

from narada import Agent, BrowserEnvironment


async def main() -> None:
env = BrowserEnvironment()
agent = Agent(environment=env, kind="/demo@narada.ai/greeter-agent")

try:
response = await agent.run(prompt="John Doe")

print("Response:", response.text)
print("Trace:")
print(
json.dumps(
[record.model_dump(mode="json") for record in response.trace],
indent=2,
)
)
finally:
await env.close()


if __name__ == "__main__":
asyncio.run(main())
Loading