Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add bureau shutdown event support #467

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

Archento
Copy link
Member

Proposed Changes

Add support for shutdown tasks within the agent Bureau

Linked Issues

Closes #90

Types of changes

  • Bug fix (non-breaking change that fixes an issue).
  • New feature added (non-breaking change that adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to stop working as expected).
  • Documentation update.
  • Something else (e.g., tests, scripts, example, deployment, infrastructure).

Checklist

  • I have read the CONTRIBUTING guide
  • Checks and tests pass locally

If applicable

  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that code coverage does not decrease
  • I have added/updated the documentation

Further comments

To verify please execute the following snippet:

from uagents import Agent, Bureau, Context

alice = Agent(name="Alice", seed="<seed>")
bob = Agent(name="Bob", seed="<seed>")

bureau = Bureau(
    agents=[alice, bob],
    port=8080,
    endpoint="http://localhost:8080/submit",
)

@alice.on_event("startup")
async def startup1(ctx: Context):
    ctx.logger.info(">>> Alice is starting up.")

@bob.on_event("startup")
async def startup2(ctx: Context):
    ctx.logger.info(">>> Bob is starting up.")

@alice.on_event("shutdown")
async def shutdown1(ctx: Context):
    ctx.logger.info(">>> Alice is shutting down.")

@bob.on_event("shutdown")
async def shutdown2(ctx: Context):
    ctx.logger.info(">>> Bob is shutting down.")

bureau.run()

@Archento Archento linked an issue Jul 19, 2024 that may be closed by this pull request
@Archento Archento merged commit ea9b3e2 into main Jul 22, 2024
9 checks passed
@Archento Archento deleted the 90-uagents-run-agent-shutdown-tasks-from-bureau branch July 22, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uAgents: run agent shutdown tasks from bureau
2 participants