# How to structure a Python project with multiple agents sharing code

**URL:** <https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86>\
**Category:** Agents\
**Tags:** python, agent-deployment\
**Created:** [January 21, 2026, 1:23pm UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86 "2026-01-21T13:23:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LiveKit-Community](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/livekit-community/32/67_2.png) [@LiveKit-Community](https://community.livekit.io/u/LiveKit-Community)\
**Post date:** [January 21, 2026, 1:23pm UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86/1 "2026-01-21T13:23:45Z")

</div>

_This question originally came up in our Slack community and the thread has been consolidated here for long-term reference._

What’s the right way to structure a Python project to deploy multiple agents while sharing some code and using a single `pyproject.toml` between them?

---

<div class="post-metadata">

**Author:** ![LiveKit-Community](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/livekit-community/32/67_2.png) [@LiveKit-Community](https://community.livekit.io/u/LiveKit-Community)\
**Post date:** [January 21, 2026, 1:23pm UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86/2 "2026-01-21T13:23:48Z")

</div>

One common approach is to have a single agent entry point for all your agents, then determine which agent logic to invoke when the entrypoint gets called. You can use dispatch metadata to customize behavior within the entrypoint.

Note that with this approach, all agents would share the same agent name - this applies to both self-hosted and LiveKit Cloud deployments. The agent name is defined before the entrypoint, so you can’t have different agent names while sharing a single entry point.

---

<div class="post-metadata">

**Author:** ![Ashwin\_Dharne](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/ashwin_dharne/32/577_2.png) [@Ashwin\_Dharne](https://community.livekit.io/u/Ashwin_Dharne)\
**Post date:** [March 6, 2026, 12:06am UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86/3 "2026-03-06T00:06:42Z")

</div>

What if it’s absolutely necessary for agents to _not_ share a name? In general, is there a way to just push a docker image to livekit cloud that we build ourselves?

---

<div class="post-metadata">

**Author:** ![CWilson](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/cwilson/32/135_2.png) [@CWilson](https://community.livekit.io/u/CWilson)\
**Post date:** [March 6, 2026, 12:47am UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86/4 "2026-03-06T00:47:42Z")

</div>

You can have many agents each with their own names. Just is shared code if you want to share code.

I am not sure what your question is

---

<div class="post-metadata">

**Author:** ![Ashwin\_Dharne](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/ashwin_dharne/32/577_2.png) [@Ashwin\_Dharne](https://community.livekit.io/u/Ashwin_Dharne)\
**Post date:** [March 6, 2026, 1:21am UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86/5 "2026-03-06T01:21:38Z")

</div>

I’m trying to use uv workspaces to have several agents and share code between them. The issue is that `lk agent deploy` has to be run from the subdir with a dockerfile, but the build context then doesn’t include the full project and required dependencies.

I was referencing the “single entry point for all agents” and “all agents would have the same name” answer above, where I would like different entrypoints for different agents that share code within a uv workspaces project. Just wondering what people are doing, or if this is an unsupported use case.

---

<div class="post-metadata">

**Author:** ![darryncampbell](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/darryncampbell/32/20_2.png) [@darryncampbell](https://community.livekit.io/u/darryncampbell)\
**Post date:** [March 6, 2026, 9:49am UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86/6 "2026-03-06T09:49:59Z")

</div>

I hadn’t come across `uv workspaces` before, I had assumed you were referencing some shared code path between two agents.

From a quick read, since `lk agent deploy` doesn’t allow you to specify the dockerfile, if you wanted multiple agents in the same project with `uv workspaces`, you would need to swap in and out the required dockerfile before calling `lk agent deploy`.

For now, I think your options are:

- Use `uv workspaces` but with logic before your deploy step to copy files around
- Use separate projects for your agents, with shared code

---

<div class="post-metadata">

**Author:** ![Ashwin\_Dharne](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/ashwin_dharne/32/577_2.png) [@Ashwin\_Dharne](https://community.livekit.io/u/Ashwin_Dharne)\
**Post date:** [March 6, 2026, 7:59pm UTC](https://community.livekit.io/t/how-to-structure-a-python-project-with-multiple-agents-sharing-code/86/7 "2026-03-06T19:59:28Z")

</div>

Yep, I’m just moving Dockerfiles around before deploy via a script now but would love more flexibility in how `lk agent deploy` works – specifying a dockerfile or even pushing our own image could generalize pretty well.
