google agentic calling your agent

So what happens after you have deployed your agent to agentic platform, you should have code to call it. How can we do that?



import asyncio
import agentplatform

client = agentplatform.Client(
    project="project-015f2405-16e7-4b36-996",
    location="us-central1",
)

async def main():
    runtime = client.runtimes.get(
        name="projects/your-project-id/locations/us-central1/
reasoningEngines/2026277059566764032"
    )
    print(runtime)

    runtime.operation_schemas()
    session = await runtime.async_create_session(user_id="user_123")

    async for event in runtime.async_stream_query(
        user_id="user_123",
        message="What is my account balance including pending charges for user_123?",
    ):
        print(event)

asyncio.run(main())


It is even documented here 

https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/runtime/quickstart-adk

And if you run it, you will get the following outputs :-






Comments

Popular posts from this blog

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

llama cpp running it in google colab