Skip to content

How to print more logs when agent running? #5640

Answered by ekzhu
Guanwei1989 asked this question in Q&A
Discussion options

You must be logged in to vote

You didn't register a handler.

import asyncio
import logging
from autogen_core import EVENT_LOGGER_NAME
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.messages import TextMessage
from autogen_core import CancellationToken
from autogen_core.memory import ListMemory, MemoryContent
from autogen_ext.models.openai import OpenAIChatCompletionClient

logger = logging.getLogger(EVENT_LOGGER_NAME)
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)

async def main() -> None:
    # Create a model client.
    model_client = OpenAIChatCompletionClient(
        model="gpt-4o-mini",
        # api_key = "your_openai_api_key"
    )

    # Create a list-ba…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Guanwei1989
Comment options

@ekzhu
Comment options

Answer selected by Guanwei1989
@ekzhu
Comment options

@Guanwei1989
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants