Skip to content

Is Agent.run and other call safe for concurrency? #3241

@xcpky

Description

@xcpky

Question

For the same agent, is it safe to call run/run_sync/... concurrently? This is important for me so I just want to make sure and it's not mentioned in the website.

For example, is the following code guaranteed to be safe?

async with asyncio.TaskGroup() as tg:
    task1 = tg.create_task(agent.run('What is a banana?'))
    task2 = tg.create_task(agent.run('What is a bicycle?'))

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions