A method for executing a program across a distributed architecture, comprising: constructing a graph comprising the generation of a plurality of nodes, wherein each node corresponds to an operation of the program, and wherein the nodes are connected by edges or vertices, representing streams being sent between the nodes, and wherein locations are automatically assigned to particular nodes; automatically sharding computations by instantiating sub-graphs multiple times, wherein only nodes comprising operators which allow for parallel instances can be sharded; partitioning the constructed graph, wherein each of the sub-graphs is executed at their respective locations and each sub-graph is executed in a respective single thread; executing, by send shards of a first sharded node of the distributed architecture, one or more operations; sending, from the send shards, tuples to at least one receive shard of a second sharded node, the tuples being part of a stream and being based on the one or more operations; sending, from each of the send shards, a token value to the at least one receive shard when the sending of the tuples in the stream is complete; determining, by the receive shard, whether a sum of the received token values at the at least one receive shard matches a number of the send shards that are expected to send a token value to the receive shard; and taking a first action by the receive shard in response to determining that the sum of the token values matches the number of the send shards, wherein taking the first action comprises at least one of marking the stream as being complete or generating a message indicating that the stream is complete; generating, by each of the send shards, a list of the receive shards with which each respective send shard has communicated; transmitting, by the send shards, the respective list to a controller; tracking, by the controller, all receive shards that have started processing; determining, by the controller, whether one or more of the receive shards that have started processing are not present in the list; and for each receive shard that has started processing and is not present in the list, sending, by the controller, a token value on behalf of the respective send shard to the receive shard. constructing a graph comprising the generation of a plurality of nodes, wherein each node corresponds to an operation of the program, and wherein the nodes are connected by edges or vertices, representing streams being sent between the nodes, and wherein locations are automatically assigned to particular nodes; automatically sharding computations by instantiating sub-graphs multiple times, wherein only nodes comprising operators which allow for parallel instances can be sharded; partitioning the constructed graph, wherein each of the sub-graphs is executed at their respective locations and each sub-graph is executed in a respective single thread; executing, by send shards of a first sharded node of the distributed architecture, one or more operations; sending, from the send shards, tuples to at least one receive shard of a second sharded node, the tuples being part of a stream and being based on the one or more operations; sending, from each of the send shards, a token value to the at least one receive shard when the sending of the tuples in the stream is complete; determining, by the receive shard, whether a sum of the received token values at the at least one receive shard matches a number of the send shards that are expected to send a token value to the receive shard; and taking a first action by the receive shard in response to determining that the sum of the token values matches the number of the send shards, wherein taking the first action comprises at least one of marking the stream as being complete or generating a message indicating that the stream is complete; generating, by each of the send shards, a list of the receive shards with which each respective send shard has communicated; transmitting, by the send shards, the respective list to a controller; tracking, by the controller, all receive shards that have started processing; determining, by the controller, whether one or more of the receive shards that have started processing are not present in the list; and for each receive shard that has started processing and is not present in the list, sending, by the controller, a token value on behalf of the respective send shard to the receive shard.