import asyncio

from nodnod.interface.node_from_function import Scope, create_node_from_function, inject_externals
from nodnod.interface.node_from_function import create_agent_from_node


def func(a: int | None, b: int) -> None:
    print(a)
    print(b)


async def main():
    node = create_node_from_function(func)
    agent = create_agent_from_node(node)
    print(node.__dependencies__)
    print(node.__externals__)
    node.__dependencies__ = set()
    scope = Scope(detail="test")

    async with scope:
        inject_externals(scope, dict(a=1, b=2))
        await agent.run(scope, mapped_scopes={})
        print(scope)


asyncio.run(main())