Skip to content

custom agent poc #92

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

wreed4
Copy link

@wreed4 wreed4 commented Apr 18, 2025

Simple POC of custom agents.

This is obviously not a complete solution, but wanted to push it for conversational purposes. The setup copies BaseAgent exactly, so this is really only sufficient for overriding methods in the BaseAgent (which is my current use-case). A generic solution would need to allow handling custom arguments in a way that I don't think this does.

@wreed4 wreed4 mentioned this pull request Apr 18, 2025
model_factory_func,
)
active_agents.update(basic_agents)

# Create parallel agents
if AgentType.PARALLEL.value in [agents_dict[name]["type"] for name in group]:
parallel_agents = await create_agents_by_type(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a fallback or raise a custom error for unsupported agent types

else:
    raise ValueError(f"Unsupported agent type: {agent_type}")

@ehsanhaq
Copy link

ehsanhaq commented May 7, 2025

This seems a nice feature. It will allow customizing the behavior of an agent.
My use case is that I am trying to build a chain of agents let's say agent1 ==> agent2, where I would like to send the last content in response of agent1 to agent2. The current implimentation passes all the contents from agent1 response to agent2.
As a workaround I am forced to implement the chaining myself instead of using the @fast.chain decorator.

@wreed4 any plan to finish the PR?

@wreed4
Copy link
Author

wreed4 commented May 14, 2025

@ehsanhaq I'm not sure I understand the codebase well enough to know if this approach is the right one. There are a few obvious gaps in this approach. I threw this up as an idea and to get some feedback from @evalstate. If folks feel like this is on the right track, I might be able to make it a bit more real. Otherwise, I mostly threw it up to start a conversation.

If someone with more familiarity with this codebase could take a look and give some feedback, that'd be super useful.

@evalstate
Copy link
Owner

sorry, this is a bit odd as i'm sure there'd already been a discussion on this one (maybe someone raised it on the discord and i was absent minded in posting here). anyway, i think this makes sense and is a neat way of approaching it. the hope always was that people would be able to create custom Agents beyond the standard workflow ones. there's a couple of related discussions here (not dependent - but things in this area to consider)

  • The use of AgentCard instead of AgentConfig -> think this might be mostly a rename...
  • Better examples of/easier signatures for programmatic agent creation
  • router.py i think is the best example of the workflows to base it on (and the other workflow agents could do with a refresh to improve their prompt engineering and use of structured outputs) - that might help with further refining this feature.

so sorry for the late reply on the PR, but this idea lgtm -- and this looks reasonably complete as is?

@wreed4
Copy link
Author

wreed4 commented May 15, 2025

The only obvious thing I thought might be missing and I didn't take the time to think out is custom arguments to the decorator. I imagine if folks want a custom agent they'll probably want custom fields in the constructor.. But we could merge as is and solve some use-cases and extend it later if you want. I'll mark it as ready for review and if there's any changes you'd like let me know.

@wreed4 wreed4 marked this pull request as ready for review May 15, 2025 14:57
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.

4 participants