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

Extend logging capabilities and agent configurability #496

Open
Archento opened this issue Aug 9, 2024 · 2 comments
Open

Extend logging capabilities and agent configurability #496

Archento opened this issue Aug 9, 2024 · 2 comments
Labels
c-investigation Category: Tracking an investigation or PoC

Comments

@Archento
Copy link
Member

Archento commented Aug 9, 2024

We need to improve logging throughout the whole framework and enable the user to configure verbosity as well as output of the logs.

  • agent already has log level as property so we'll only need to provide the means for piping the logs to a file (or similar means)
  • logging within the framework is mainly happening on the INFO level but under-the-hood actions should be logged as well to properly debug a running agent

Potential solution could be a config mapping which may be created by the user or generated and filled with default values on demand by running the agent with a CLI argument.

Agent instantiation

agent = Agent(
    name="<your_name>",
    seed="<your_seed>",
    [...],
    config=AgentConfig(
        path="./my_agent.yaml",
        **kwargs   # maybe individual config values
    )
)

my_agent.yaml

name: "bert"
port: 8000
seed: "..."
endpoint: "http://localhost:8000/submit"
enable_wallet_messaging: false
version: "v20.0.9"
log_level: "DEBUG"
log_file: "./${timestamp}_${agent_address}.log"
...

By using this approach it should also be easier to scale agent deployment if we can put every agent init argument inside the config map, enabling the developer to invoke:

configs= ["./config_a.yaml", "./config_b.yaml", ...]  # list of config files

agents = []
for conf in configs:
    agents.append(Agent(config=conf))
@jrriehl jrriehl added the c-investigation Category: Tracking an investigation or PoC label Aug 19, 2024
@Archento
Copy link
Member Author

Add automatic logging of agent address on agent startup.

@Archento
Copy link
Member Author

I think there are two main approaches when it comes to configuration files:

  • simply loading the file (.yaml in this case), create a dict of values to be used as a direct way of creating an agent, or
  • loading an AgentConfig object from a file which includes type validation to create agents from.

Both can coexist but we may want to force one of the usage of one over the other.

Screenshot 2024-09-12 at 12 17 20


We can think about adding the AgentConfig object to the agent by default so that config handling will be more natively embedded in the framework.

Screenshot 2024-09-12 at 12 28 22


Using yaml files makes handling of multiple agents very easy as the configs just need to be separated by --- for it to be loaded like this:

"""yaml contents
name: alice
seed: ...
---
name: bob
seed: ...
"""

confs = load_configs(PATH) # multiple configs in one file

bureau = Bureau()
for conf in confs:
    bureau.add(Agent(**conf))

bureau.run()

Requirements

  • after the process, one (or multiple of) working agent(s) needs to be instantiated
  • the process should feel native, i.e. nothing should fundamentally change from a dev perspective apart from slight additions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-investigation Category: Tracking an investigation or PoC
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants