Skip to content

The getting started example is not working any more for AG UI Integration #406

@mjmadhu

Description

@mjmadhu

Error thrown on executing the AG_UI Chat client -

Traceback (most recent call last):
File "...\AG_UI_ChatClient.py", line 6, in
from agent_framework import Agent, ToolCallContent, ToolResultContent
ImportError: cannot import name 'ToolCallContent' from 'agent_framework' (...\Lib\site-packages\agent_framework_init_.py)

Proposed changes that are working -
............

Create AG-UI chat client

chat_client = AGUIChatClient(**endpoint**=server_url)

..........

Display tool calls and results

            for content in (update.contents or []):
                content_type = getattr(content, "type", "")
                if content_type == "function_call":
                    tool_name = getattr(content, "name", None) or "unknown"
                    print(f"\n\033[95m[Calling tool: {tool_name}]\033[0m")
                elif content_type in {"function_result", "tool_result"}:
                    result = getattr(content, "result", None)
                    if result is None:
                        result = getattr(content, "tool_result", None)
                    result_text = result if isinstance(result, str) else str(result)
                    print(f"\033[94m[Tool result: {result_text}]\033[0m")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions