Skip to content

how to use AgentInstantiationContext? #5506

Answered by ekzhu
bio-mlhui asked this question in Q&A
Discussion options

You must be logged in to vote

Why do you need to pass the runtime and key? Inside the agent constructor you can already get the runtime and key from the AgentInstantiationContext:

from autogen_core import AgentInstantiationContext

# The following code must be inside the factory method. 
agent_id = AgentInstantiationContext.current_agent_id()
runtime = AgentInstantiationContext.current_runtime()

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ekzhu
Comment options

Answer selected by bio-mlhui
@bio-mlhui
Comment options

@ekzhu
Comment options

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

This discussion was converted from issue #5504 on February 12, 2025 06:12.