Supported Frameworks
| Framework | Detection | Per-Process Identity |
|---|---|---|
| CrewAI | from crewai import ... | Each crew role gets a SPIFFE ID |
| LangChain | from langchain import ... | Agent chains get identity |
| AutoGen | from autogen import ... | Each AutoGen agent gets identity |
| Strands | from strands import ... | Agent strands get identity |
| OpenAI Swarm | from swarm import ... | Swarm agents get identity |
| Pure Python | No framework imports | Single identity per agent |
CrewAI Example
from crewai import Agent, Task, Crew
from hexr import hexr_agent, hexr_tool, hexr_llm
@hexr_agent(name="content-crew", tenant="acme-corp", framework="crewai")
def main():
researcher = Agent(
role="researcher",
goal="Find latest AI news",
backstory="Senior research analyst",
)
writer = Agent(
role="writer",
goal="Write engaging articles",
backstory="Content strategist",
)
research_task = Task(
description="Research the latest developments in AI agents",
agent=researcher,
)
write_task = Task(
description="Write a blog post based on the research",
agent=writer,
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task],
)
result = crew.kickoff()
print(result)
if __name__ == "__main__":
main()
researcher→spiffe://hexr.cloud/agent/acme-corp/content-crew/researcherwriter→spiffe://hexr.cloud/agent/acme-corp/content-crew/writer- Each role gets separate cloud credentials and cost attribution
LangChain Example
from langchain.agents import initialize_agent, Tool
from langchain_openai import ChatOpenAI
from hexr import hexr_agent, hexr_tool
@hexr_agent(name="langchain-research", tenant="acme-corp", framework="langchain")
def main():
llm = ChatOpenAI(model="gpt-4o")
tools = [
Tool(
name="S3 Lookup",
func=lambda q: hexr_tool("aws_s3").get_object(
Bucket="data", Key=q)["Body"].read().decode(),
description="Look up data in S3",
),
]
agent = initialize_agent(tools, llm, agent="zero-shot-react-description")
result = agent.run("Find the latest sales report")
print(result)
if __name__ == "__main__":
main()
AutoGen Example
from autogen import AssistantAgent, UserProxyAgent
from hexr import hexr_agent
@hexr_agent(name="autogen-coder", tenant="acme-corp", framework="autogen")
def main():
assistant = AssistantAgent(
name="coder",
llm_config={"model": "gpt-4o"},
)
user_proxy = UserProxyAgent(
name="user",
human_input_mode="NEVER",
code_execution_config={"work_dir": "/tmp/code"},
)
user_proxy.initiate_chat(
assistant,
message="Write a Python function to calculate fibonacci numbers",
)
if __name__ == "__main__":
main()
Build Any Framework
Thehexr build command auto-detects the framework:
$ hexr build content_crew.py --tenant acme-corp
Analyzing content_crew.py...
Framework: crewai (detected from imports)
Agents: 2 (researcher, writer)
...
--framework:
hexr build agent.py --tenant acme --framework langchain